msg116883 - (view) |
Author: Ismail Donmez (donmez) * |
Date: 2010-09-19 20:42 |
py3k branch, revision 84907 ====================================================================== ERROR: test_font_eq (tkinter.test.test_tkinter.test_font.FontTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/cartman/Sources/py3k/Lib/tkinter/test/test_tkinter/test_font.py", line 10, in test_font_eq font1 = font.nametofont("system") File "/Users/cartman/Sources/py3k/Lib/tkinter/font.py", line 22, in nametofont return Font(name=name, exists=True) File "/Users/cartman/Sources/py3k/Lib/tkinter/font.py", line 83, in __init__ "named font %s does not already exist" % (self.name,)) _tkinter.TclError: named font system does not already exist |
|
|
msg116906 - (view) |
Author: Ned Deily (ned.deily) *  |
Date: 2010-09-20 02:25 |
r84865 for Issue1730136 introduced a new tkinter test, test_font. As it stands, the test fails on OS X 10.6 when Python is built with Aqua Tk, at least with either the Apple-supplied 8.5 or the ActiveState 8.5 (I haven't tried with any of the Aqua 8.4 version). The main problem is that font "system" is not a font name returned by the interface used by tkinter/font.py: $ /usr/bin/wish8.5 % font names systemPushButtonFont systemMenuItemFont systemApplicationFont systemSystemFont systemMenuItemMarkFont TkMenuFont TkDefaultFont systemSmallEmphasizedSystemFont systemDetailEmphasizedSystemFont systemMiniSystemFont TkHeadingFont TkTooltipFont systemUtilityWindowTitleFont systemViewsFont systemSmallSystemFont systemMenuTitleFont systemEmphasizedSystemFont TkTextFont systemDetailSystemFont TkCaptionFont systemLabelFont systemAlertHeaderFont systemMenuItemCmdKeyFont TkSmallCaptionFont TkFixedFont systemWindowTitleFont systemToolbarFont TkIconFont % font actual system -family {Lucida Grande} -size 13 -weight normal -slant roman -underline 0 -overstrike 0 Based on the man page here (http://www.tcl.tk/man/tcl8.5/TkCmd/font.htm#M31) it appears any of the "standard" font names would be a better choice, like TkDefaultFont. Also, test_font should include the standard tkinter.test setUp and setDown functions so that the test can be run by itself. The attached patch should fix both issues. |
|
|
msg116933 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2010-09-20 13:37 |
Patch works here (Mandriva Linux). |
|
|
msg117023 - (view) |
Author: Ned Deily (ned.deily) *  |
Date: 2010-09-21 03:21 |
Somebody want to commit it? |
|
|
msg117080 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2010-09-21 16:26 |
Patch committed in r84952. Thanks! |
|
|
msg117414 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2010-09-26 12:31 |
Actually, most buildbots were fixed but a couple of them still show a problem: test_font_eq (tkinter.test.test_tkinter.test_font.FontTest) ... ERROR testLoadTk (tkinter.test.test_tkinter.test_loadtk.TkLoadTest) ... skipped 'No $DISPLAY set.' testLoadTkFailure (tkinter.test.test_tkinter.test_loadtk.TkLoadTest) ... ok test_search (tkinter.test.test_tkinter.test_text.TextTest) ... ok ====================================================================== ERROR: test_font_eq (tkinter.test.test_tkinter.test_font.FontTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/tkinter/test/test_tkinter/test_font.py", line 18, in test_font_eq font1 = font.nametofont("TkDefaultFont") File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/tkinter/font.py", line 22, in nametofont return Font(name=name, exists=True) File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/tkinter/font.py", line 83, in __init__ "named font %s does not already exist" % (self.name,)) _tkinter.TclError: named font TkDefaultFont does not already exist Intriguingly, when the test gets re-run at the end of the test suite, the test succeeds. Does it depend on another initialization that is done in another test file? |
|
|
msg117420 - (view) |
Author: Ned Deily (ned.deily) *  |
Date: 2010-09-26 16:28 |
Could be, particularly if the user name under which the test is running is not logged in (to the window manager) on the buildbot. I'll investigate. |
|
|
msg117990 - (view) |
Author: Ned Deily (ned.deily) *  |
Date: 2010-10-05 05:04 |
After further investigation, on OS X at least, there is a difference in behavior between Tk 8.4 (the system default on OS X 10.4 and 10.5) and Tk 8.5 (the default on 10.6). Lib/tkinter/font.py calls the Tk "font names" commands to check whether a font is already defined. At the point where test_font.py is initially run, there has not been any real Tk activity yet. For some reason, with 8.5 the system font names are returned; with 8.4 they are not: $ /usr/bin/wish8.4 % font names $ /usr/bin/wish8.5 % font names systemPushButtonFont systemMenuItemFont systemApplicationFont systemSystemFont systemMenuItemMarkFont TkMenuFont TkDefaultFont systemSmallEmphasizedSystemFont systemDetailEmphasizedSystemFont systemMiniSystemFont TkHeadingFont TkTooltipFont systemUtilityWindowTitleFont systemViewsFont systemSmallSystemFont systemMenuTitleFont systemEmphasizedSystemFont TkTextFont systemDetailSystemFont TkCaptionFont systemLabelFont systemAlertHeaderFont systemMenuItemCmdKeyFont TkSmallCaptionFont TkFixedFont systemWindowTitleFont systemToolbarFont TkIconFont So, a solution for that is to add a try block in test_font.py to create a font definition for TkDefaultFont if it does not already exist. (Presumably, after the test failed and before it was re-run, other tests ran which caused the fonts to be defined so it passes.) This time I have tested it with both Tk 8.4 and 8.5 on OS X 10.5 and 10.6. Additional patch file attached (to be applied on top of the already applied first patch). |
|
|
msg118003 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2010-10-05 11:25 |
I've committed the patch in r85229. Let's see if this makes the buildbots happy. |
|
|
msg118007 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2010-10-05 12:43 |
Looks alright, thank you! |
|
|