-
-
Notifications
You must be signed in to change notification settings - Fork 29.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_tk fails on OS X with multiple test case failures with both Tk 8.5 and 8.4 #63960
Comments
As of 3.4.0b1, the following test failures are observed with Tk 8.5 on OS X (python.org 64-/32- installer with ActiveTcl 8.5.15.1 on OS X 10.9): ====================================================================== Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 240, in test_bitmap
errmsg='bitmap "spam" not defined')
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 75, in checkInvalidParam
widget[name] = value
AssertionError: TclError not raised ====================================================================== Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 240, in test_bitmap
errmsg='bitmap "spam" not defined')
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 75, in checkInvalidParam
widget[name] = value
AssertionError: TclError not raised ====================================================================== Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_widgets.py", line 333, in test_insertborderwidth
self.checkPixelsParam(widget, 'insertborderwidth', 0, 1.3, -2)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 169, in checkPixelsParam
conv=conv1, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 59, in checkParam
self.assertEqual2(widget[name], expected, eq=eq)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 43, in assertEqual2
self.assertEqual(actual, expected, msg)
AssertionError: 0 != 1 ====================================================================== Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 240, in test_bitmap
errmsg='bitmap "spam" not defined')
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 75, in checkInvalidParam
widget[name] = value
AssertionError: TclError not raised ====================================================================== Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 240, in test_bitmap
errmsg='bitmap "spam" not defined')
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 75, in checkInvalidParam
widget[name] = value
AssertionError: TclError not raised ====================================================================== Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 240, in test_bitmap
errmsg='bitmap "spam" not defined')
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 75, in checkInvalidParam
widget[name] = value
AssertionError: TclError not raised ====================================================================== Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 240, in test_bitmap
errmsg='bitmap "spam" not defined')
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 75, in checkInvalidParam
widget[name] = value
AssertionError: TclError not raised ====================================================================== Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_widgets.py", line 333, in test_insertborderwidth
self.checkPixelsParam(widget, 'insertborderwidth', 0, 1.3, -2)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 169, in checkPixelsParam
conv=conv1, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 59, in checkParam
self.assertEqual2(widget[name], expected, eq=eq)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 43, in assertEqual2
self.assertEqual(actual, expected, msg)
AssertionError: 0 != 1 The following test failures are observed with Tk 8.4 on OS X (python.org 32-only installer with ActiveTcl 8.4.20 on OS X 10.5.8): ====================================================================== Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_text.py", line 22, in test_debug
self.assertEqual(text.debug(), 0)
AssertionError: '0' != 0 ====================================================================== Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_widgets.py", line 333, in test_insertborderwidth
self.checkPixelsParam(widget, 'insertborderwidth', 0, 1.3, -2)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 169, in checkPixelsParam
conv=conv1, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 59, in checkParam
self.assertEqual2(widget[name], expected, eq=eq)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 43, in assertEqual2
self.assertEqual(actual, expected, msg)
AssertionError: 0 != 1 ====================================================================== Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_widgets.py", line 333, in test_insertborderwidth
self.checkPixelsParam(widget, 'insertborderwidth', 0, 1.3, -2)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 169, in checkPixelsParam
conv=conv1, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 59, in checkParam
self.assertEqual2(widget[name], expected, eq=eq)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 43, in assertEqual2
self.assertEqual(actual, expected, msg)
AssertionError: 0 != 1 |
There are three different classes of errors here:
This has already been fixed by 7dab4feec126/05e84d3ecd1e/e7d922d8ee03 for bpo-6517.
This appears to be a bug in Cocoa Tk, reproducible with the wish shell. I've opened a Tk issue for it: https://core.tcl.tk/tk/tktview?name=31cd33dbf0 The simplest approach would be to just skip test_bitmap for OS X until this is fixed. A more focused workaround patch would be to only skip the checkInvalidParam test when running under Cocoa Tk:
After a little investigation, I think this is a test case error. at least for Entry. According to third-party Tkinter documentation (http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/entry.html) for the Entry widget: "By default, the insertion cursor is a simple rectangle. You can get the cursor with the tk.RAISED relief effect (see Section 5.6, 'Relief styles') by setting insertborderwidth to the dimension of the 3-d border. If you do, make sure that the insertwidth option is at least twice that value." It looks like for both the OS X Carbon (8.4) and Cocoa (8.5 and 8.6) Tks, the restriction about insertwidth is enforced, but with the X11 Tk, it is not. Some examples using Cocoa Tk (8.5.15) and 3.4.0b3:
>>> from tkinter import *; r = Tk()
>>> w = Entry(r, insertborderwidth=1.3); w.pack(); w['insertborderwidth']
0
>>> w = Entry(r, insertborderwidth=1.3, insertwidth=10); w.pack(); w['insertborderwidth']
1
>>> w = Entry(r, insertborderwidth=2); w.pack(); w['insertborderwidth']
0
>>> w = Entry(r, insertborderwidth=2, insertwidth=10); w.pack(); w['insertborderwidth']
2
>>> w = Entry(r, insertborderwidth='10p'); w.pack(); w['insertborderwidth']
0
>>> w = Entry(r, insertborderwidth='10p', insertwidth=10); w.pack(); w['insertborderwidth']
5
Using X11 Tk (8.6.1) on OS X:
>>> from tkinter import *; r = Tk()
>>> w = Entry(r, insertborderwidth=1.3); w.pack(); w['insertborderwidth']
1
>>> w = Entry(r, insertborderwidth=1.3, insertwidth=10); w.pack(); w['insertborderwidth']
1
>>> w = Entry(r, insertborderwidth=2); w.pack(); w['insertborderwidth']
1
>>> w = Entry(r, insertborderwidth=2, insertwidth=10); w.pack(); w['insertborderwidth']
2
>>> w = Entry(r, insertborderwidth='10p'); w.pack(); w['insertborderwidth']
1
>>> w = Entry(r, insertborderwidth='10p', insertwidth=10); w.pack(); w['insertborderwidth']
5 So it appears the tests could be made to pass on OS X Cocoa and Carbon Tks and on X11 Tks if insertwidth is also set on the insertborderwidth tests. That would need to be tested with Windows Tk. |
Thank you Ned for your great investigation. Here is a patch for these two bugs. A test for invalid bitmap is skipped (also added a test for bitmap specified in external file). For insertborderwidth tests the insertwidth value is explicitly increased (yes, the Tk source code bounds insertborderwidth by insertwidth/2). |
The supplied patch fixed all of the failing test cases on OS X, tested on 3.3 and default with Cocoa Tk 8.5 & 8.6, Carbon Tk 8.4, and X11 Tk 8.6. I'll test on 2.7 after the modified patch is applied. Thanks, Serhiy! |
New changeset 129eb818d9b2 by Serhiy Storchaka in branch '2.7': New changeset 76cd2e59b13d by Serhiy Storchaka in branch '3.3': New changeset 2efe0778a4cf by Serhiy Storchaka in branch 'default': |
Thank you Ned. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: