-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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_ttk_guionly test failures on macOS with Tcl/Tk 8.6.10 #86673
Comments
As of 3.9.1rc1 (and coming soon to 3.10.x and 3.8.x), we now provide a new additional macOS universal2 installer variant that, for various reasons, provides a built-in version of Tcl/Tk 8.6.10, instead of 8.6.8 as has been provided with the 10.9 installer variant. Using 8.6.10 on nacOS, six test_ttk_guionly tests fail while passing using 8.6.8 ib nacOS. Similar results were obtained when running the tests on either macOS 10.15.7 or 11.0.1. The failures: ====================================================================== Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/test/test_ttk/test_widgets.py", line 334, in test_identify
self.assertIn(self.entry.identify(5, 5),
AssertionError: '' not found in ('textarea', 'Combobox.button') ====================================================================== Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/test/test_ttk/test_widgets.py", line 334, in test_identify
self.assertIn(self.entry.identify(5, 5),
AssertionError: '' not found in ('textarea', 'Combobox.button') ====================================================================== Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/test/test_ttk/test_widgets.py", line 1155, in test_command
self.assertTrue(success)
AssertionError: [] is not true ====================================================================== Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/test/test_ttk/test_widgets.py", line 334, in test_identify
self.assertIn(self.entry.identify(5, 5),
AssertionError: 'Spinbox.field' not found in ('textarea', 'Combobox.button') ====================================================================== Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/test/test_ttk/test_widgets.py", line 1353, in test_bbox
self.assertIsBoundingBox(bbox)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/test/widget_tests.py", line 197, in assertIsBoundingBox
self.assertIsInstance(bbox, tuple)
AssertionError: '' is not an instance of <class 'tuple'> ====================================================================== Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/test/test_ttk/test_widgets.py", line 68, in test_identify
self.assertEqual(self.widget.identify(
AssertionError: '' != 'label'
+ label |
I tested on 3.9 with the backport of #67662 merged. The six failures are still there plus there is now an additional failure: ====================================================================== Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/tkinter/test/test_ttk/test_extensions.py", line 121, in test_horizontal_range
self.assertEqual(prev_xcoord, int(linfo_1['x']))
AssertionError: 12 != 0 |
I have no ideas. Try to add more calls of update() in these tests. |
Can I get a remote access to machine with macOS? |
It might be the tk/tkinter build, not the tests, that is at fault. That is my current conclusion for bpo-42508 (regarding IDLE as a test). |
Terry:
Can you elaborate? |
The test may be correctly detecting a change in widget behavior. This is less surprising to me than some keypresses acting like two keypresses a millesecond apart. |
OK, thanks for the clarification, Terry. Considering that our tkinter tests make assumptions about the underlying Tk widgets behavior, assumptions not necessarily shared by the Tk developers :), these kind of version-dependent failures are a risk of and shortcoming of having extensive tests like these. I'm not overly concerned about the failures other than it is not good to have failing tests. Serihy: "Can I get a remote access to machine with macOS?" Sorry, that's difficult for me to provide right now; perhaps later. Anyone else? |
All these failures point not on some details of appearance, but that the widget is not rendered at all. |
I might be able to debug during the weekend, but my main focus will be on back porting the changes in bpo-41100 to the 3.8 branch (or at least parts of it). |
Failure on the Ubuntu job run on my PR 24353: https://github.com/python/cpython/pull/24353/checks?check_run_id=1776422914 ====================================================================== Traceback (most recent call last):
File "/home/runner/work/cpython/cpython/Lib/tkinter/test/test_ttk/test_widgets.py", line 335, in test_identify
self.assertEqual(self.entry.identify(5, 5), "textarea")
AssertionError: '' != 'textarea'
+ textarea |
FWIW, I'm unable to reproduce on Python 3.9 through 3.11 (python.org binarier). I can reproduce with Homebrew supplied Python 3.8, though. |
What's the Tcl/Tk version for the homebrew installation? ( If that's an older version than 8.6.12 this could be a bug in Tcl/Tk. |
Same version as we supply:
FTR, ditto for 3.10 and 3.11. |
I ran "python3.13 -m test test_tkinter -v -u gui" for a The framework itself was build using the default deployment target on 14.2. In both runs I get no test failures. |
With the same installation I can mostly reproduce using:
Output is with deployment target 10.9 for Tcl/Tk. What I don't understand is that "python -m test test_ttk -u gui" works fine, but running the test directly doesn't work. The patch below fixes the first error: diff --git a/Lib/test/test_ttk/test_style.py b/Lib/test/test_ttk/test_style.py
index 9a04a95dc4..1eae997152 100644
--- a/Lib/test/test_ttk/test_style.py
+++ b/Lib/test/test_ttk/test_style.py
@@ -227,12 +227,12 @@ def test_element_create_image(self):
foreground='blue', background='yellow')
img3 = tkinter.BitmapImage(master=self.root, file=imgfile,
foreground='white', background='black')
- style.element_create('Button.button', 'image',
+ style.element_create('Button.button2', 'image',
img1, ('pressed', img2), ('active', img3),
border=(2, 4), sticky='we')
- self.assertIn('Button.button', style.element_names())
+ self.assertIn('Button.button2', style.element_names())
- style.layout('Button', [('Button.button', {'sticky': 'news'})])
+ style.layout('Button', [('Button.button2', {'sticky': 'news'})])
b = ttk.Button(self.root, style='Button')
b.pack(expand=True, fill='both')
self.assertEqual(b.winfo_reqwidth(), 16) This seems to indicate that there's a default "Button.button" style that we cannot replace (he says with barely any knowledge of Tk). The other test appears to be very fragile. What is this supposed to test exactly? The scriptlet below creates a import tkinter
from tkinter import ttk
root = tkinter.Tk()
entry = ttk.Entry(root)
entry.pack()
entry.update()
for x in range(50):
for y in range(50):
if entry.identify(x, y):
print(f"({x}, {y}: {entry.identify(x, y)}") This prints: "Entry.field" for the for low values of x and y, but can also print "textarea", see details below. This might show the internal structure of the ttk entry widget. Script output``` (0, 0): Entry.field (0, 1): Entry.field (0, 2): Entry.field (0, 3): Entry.field (0, 4): Entry.field (0, 5): Entry.field (0, 6): Entry.field (0, 7): Entry.field (0, 8): Entry.field (0, 9): Entry.field (0, 10): Entry.field (0, 11): Entry.field (0, 12): Entry.field (0, 13): Entry.field (0, 14): Entry.field (0, 15): Entry.field (0, 16): Entry.field (0, 17): Entry.field (0, 18): Entry.field (0, 19): Entry.field (0, 20): Entry.field (0, 21): Entry.field (0, 22): Entry.field (0, 23): Entry.field (0, 24): Entry.field (0, 25): Entry.field (0, 26): Entry.field (1, 0): Entry.field (1, 1): Entry.field (1, 2): Entry.field (1, 3): Entry.field (1, 4): Entry.field (1, 5): Entry.field (1, 6): Entry.field (1, 7): Entry.field (1, 8): Entry.field (1, 9): Entry.field (1, 10): Entry.field (1, 11): Entry.field (1, 12): Entry.field (1, 13): Entry.field (1, 14): Entry.field (1, 15): Entry.field (1, 16): Entry.field (1, 17): Entry.field (1, 18): Entry.field (1, 19): Entry.field (1, 20): Entry.field (1, 21): Entry.field (1, 22): Entry.field (1, 23): Entry.field (1, 24): Entry.field (1, 25): Entry.field (1, 26): Entry.field (2, 0): Entry.field (2, 1): Entry.field (2, 2): Entry.field (2, 3): Entry.field (2, 4): Entry.field (2, 5): Entry.field (2, 6): Entry.field (2, 7): Entry.field (2, 8): Entry.field (2, 9): Entry.field (2, 10): Entry.field (2, 11): Entry.field (2, 12): Entry.field (2, 13): Entry.field (2, 14): Entry.field (2, 15): Entry.field (2, 16): Entry.field (2, 17): Entry.field (2, 18): Entry.field (2, 19): Entry.field (2, 20): Entry.field (2, 21): Entry.field (2, 22): Entry.field (2, 23): Entry.field (2, 24): Entry.field (2, 25): Entry.field (2, 26): Entry.field (3, 0): Entry.field (3, 1): Entry.field (3, 2): Entry.field (3, 3): Entry.field (3, 4): Entry.field (3, 5): Entry.field (3, 6): Entry.field (3, 7): Entry.field (3, 8): Entry.field (3, 9): Entry.field (3, 10): Entry.field (3, 11): Entry.field (3, 12): Entry.field (3, 13): Entry.field (3, 14): Entry.field (3, 15): Entry.field (3, 16): Entry.field (3, 17): Entry.field (3, 18): Entry.field (3, 19): Entry.field (3, 20): Entry.field (3, 21): Entry.field (3, 22): Entry.field (3, 23): Entry.field (3, 24): Entry.field (3, 25): Entry.field (3, 26): Entry.field (4, 0): Entry.field (4, 1): Entry.field (4, 2): Entry.field (4, 3): Entry.field (4, 4): Entry.field (4, 5): Entry.field (4, 6): Entry.field (4, 7): Entry.field (4, 8): Entry.field (4, 9): Entry.field (4, 10): Entry.field (4, 11): Entry.field (4, 12): Entry.field (4, 13): Entry.field (4, 14): Entry.field (4, 15): Entry.field (4, 16): Entry.field (4, 17): Entry.field (4, 18): Entry.field (4, 19): Entry.field (4, 20): Entry.field (4, 21): Entry.field (4, 22): Entry.field (4, 23): Entry.field (4, 24): Entry.field (4, 25): Entry.field (4, 26): Entry.field (5, 0): Entry.field (5, 1): Entry.field (5, 2): Entry.field (5, 3): Entry.field (5, 4): Entry.field (5, 5): Entry.field (5, 6): Entry.field (5, 7): Entry.field (5, 8): Entry.field (5, 9): Entry.field (5, 10): Entry.field (5, 11): Entry.field (5, 12): Entry.field (5, 13): Entry.field (5, 14): Entry.field (5, 15): Entry.field (5, 16): Entry.field (5, 17): Entry.field (5, 18): Entry.field (5, 19): Entry.field (5, 20): Entry.field (5, 21): Entry.field (5, 22): Entry.field (5, 23): Entry.field (5, 24): Entry.field (5, 25): Entry.field (5, 26): Entry.field (6, 0): Entry.field (6, 1): Entry.field (6, 2): Entry.field (6, 3): Entry.field (6, 4): Entry.field (6, 5): Entry.field (6, 6): Entry.field (6, 7): Entry.field (6, 8): Entry.field (6, 9): Entry.field (6, 10): Entry.field (6, 11): Entry.field (6, 12): Entry.field (6, 13): Entry.field (6, 14): Entry.field (6, 15): Entry.field (6, 16): Entry.field (6, 17): Entry.field (6, 18): Entry.field (6, 19): Entry.field (6, 20): Entry.field (6, 21): Entry.field (6, 22): Entry.field (6, 23): Entry.field (6, 24): Entry.field (6, 25): Entry.field (6, 26): Entry.field (7, 0): Entry.field (7, 1): Entry.field (7, 2): Entry.field (7, 3): Entry.field (7, 4): Entry.field (7, 5): textarea (7, 6): textarea (7, 7): textarea (7, 8): textarea (7, 9): textarea (7, 10): textarea (7, 11): textarea (7, 12): textarea (7, 13): textarea (7, 14): textarea (7, 15): textarea (7, 16): textarea (7, 17): textarea (7, 18): textarea (7, 19): textarea (7, 20): textarea (7, 21): Entry.field (7, 22): Entry.field (7, 23): Entry.field (7, 24): Entry.field (7, 25): Entry.field (7, 26): Entry.field (8, 0): Entry.field (8, 1): Entry.field (8, 2): Entry.field (8, 3): Entry.field (8, 4): Entry.field (8, 5): textarea (8, 6): textarea (8, 7): textarea (8, 8): textarea (8, 9): textarea (8, 10): textarea (8, 11): textarea (8, 12): textarea (8, 13): textarea (8, 14): textarea (8, 15): textarea (8, 16): textarea (8, 17): textarea (8, 18): textarea (8, 19): textarea (8, 20): textarea (8, 21): Entry.field (8, 22): Entry.field (8, 23): Entry.field (8, 24): Entry.field (8, 25): Entry.field (8, 26): Entry.field (9, 0): Entry.field (9, 1): Entry.field (9, 2): Entry.field (9, 3): Entry.field (9, 4): Entry.field (9, 5): textarea (9, 6): textarea (9, 7): textarea (9, 8): textarea (9, 9): textarea (9, 10): textarea (9, 11): textarea (9, 12): textarea (9, 13): textarea (9, 14): textarea (9, 15): textarea (9, 16): textarea (9, 17): textarea (9, 18): textarea (9, 19): textarea (9, 20): textarea (9, 21): Entry.field (9, 22): Entry.field (9, 23): Entry.field (9, 24): Entry.field (9, 25): Entry.field (9, 26): Entry.field (10, 0): Entry.field (10, 1): Entry.field (10, 2): Entry.field (10, 3): Entry.field (10, 4): Entry.field (10, 5): textarea (10, 6): textarea (10, 7): textarea (10, 8): textarea (10, 9): textarea (10, 10): textarea (10, 11): textarea (10, 12): textarea (10, 13): textarea (10, 14): textarea (10, 15): textarea (10, 16): textarea (10, 17): textarea (10, 18): textarea (10, 19): textarea (10, 20): textarea (10, 21): Entry.field (10, 22): Entry.field (10, 23): Entry.field (10, 24): Entry.field (10, 25): Entry.field (10, 26): Entry.field (11, 0): Entry.field (11, 1): Entry.field (11, 2): Entry.field (11, 3): Entry.field (11, 4): Entry.field (11, 5): textarea (11, 6): textarea (11, 7): textarea (11, 8): textarea (11, 9): textarea (11, 10): textarea (11, 11): textarea (11, 12): textarea (11, 13): textarea (11, 14): textarea (11, 15): textarea (11, 16): textarea (11, 17): textarea (11, 18): textarea (11, 19): textarea (11, 20): textarea (11, 21): Entry.field (11, 22): Entry.field (11, 23): Entry.field (11, 24): Entry.field (11, 25): Entry.field (11, 26): Entry.field (12, 0): Entry.field (12, 1): Entry.field (12, 2): Entry.field (12, 3): Entry.field (12, 4): Entry.field (12, 5): textarea (12, 6): textarea (12, 7): textarea (12, 8): textarea (12, 9): textarea (12, 10): textarea (12, 11): textarea (12, 12): textarea (12, 13): textarea (12, 14): textarea (12, 15): textarea (12, 16): textarea (12, 17): textarea (12, 18): textarea (12, 19): textarea (12, 20): textarea (12, 21): Entry.field (12, 22): Entry.field (12, 23): Entry.field (12, 24): Entry.field (12, 25): Entry.field (12, 26): Entry.field (13, 0): Entry.field (13, 1): Entry.field (13, 2): Entry.field (13, 3): Entry.field (13, 4): Entry.field (13, 5): textarea (13, 6): textarea (13, 7): textarea (13, 8): textarea (13, 9): textarea (13, 10): textarea (13, 11): textarea (13, 12): textarea (13, 13): textarea (13, 14): textarea (13, 15): textarea (13, 16): textarea (13, 17): textarea (13, 18): textarea (13, 19): textarea (13, 20): textarea (13, 21): Entry.field (13, 22): Entry.field (13, 23): Entry.field (13, 24): Entry.field (13, 25): Entry.field (13, 26): Entry.field (14, 0): Entry.field (14, 1): Entry.field (14, 2): Entry.field (14, 3): Entry.field (14, 4): Entry.field (14, 5): textarea (14, 6): textarea (14, 7): textarea (14, 8): textarea (14, 9): textarea (14, 10): textarea (14, 11): textarea (14, 12): textarea (14, 13): textarea (14, 14): textarea (14, 15): textarea (14, 16): textarea (14, 17): textarea (14, 18): textarea (14, 19): textarea (14, 20): textarea (14, 21): Entry.field (14, 22): Entry.field (14, 23): Entry.field (14, 24): Entry.field (14, 25): Entry.field (14, 26): Entry.field (15, 0): Entry.field (15, 1): Entry.field (15, 2): Entry.field (15, 3): Entry.field (15, 4): Entry.field (15, 5): textarea (15, 6): textarea (15, 7): textarea (15, 8): textarea (15, 9): textarea (15, 10): textarea (15, 11): textarea (15, 12): textarea (15, 13): textarea (15, 14): textarea (15, 15): textarea (15, 16): textarea (15, 17): textarea (15, 18): textarea (15, 19): textarea (15, 20): textarea (15, 21): Entry.field (15, 22): Entry.field (15, 23): Entry.field (15, 24): Entry.field (15, 25): Entry.field (15, 26): Entry.field (16, 0): Entry.field (16, 1): Entry.field (16, 2): Entry.field (16, 3): Entry.field (16, 4): Entry.field (16, 5): textarea (16, 6): textarea (16, 7): textarea (16, 8): textarea (16, 9): textarea (16, 10): textarea (16, 11): textarea (16, 12): textarea (16, 13): textarea (16, 14): textarea (16, 15): textarea (16, 16): textarea (16, 17): textarea (16, 18): textarea (16, 19): textarea (16, 20): textarea (16, 21): Entry.field (16, 22): Entry.field (16, 23): Entry.field (16, 24): Entry.field (16, 25): Entry.field (16, 26): Entry.field (17, 0): Entry.field (17, 1): Entry.field (17, 2): Entry.field (17, 3): Entry.field (17, 4): Entry.field (17, 5): textarea (17, 6): textarea (17, 7): textarea (17, 8): textarea (17, 9): textarea (17, 10): textarea (17, 11): textarea (17, 12): textarea (17, 13): textarea (17, 14): textarea (17, 15): textarea (17, 16): textarea (17, 17): textarea (17, 18): textarea (17, 19): textarea (17, 20): textarea (17, 21): Entry.field (17, 22): Entry.field (17, 23): Entry.field (17, 24): Entry.field (17, 25): Entry.field (17, 26): Entry.field (18, 0): Entry.field (18, 1): Entry.field (18, 2): Entry.field (18, 3): Entry.field (18, 4): Entry.field (18, 5): textarea (18, 6): textarea (18, 7): textarea (18, 8): textarea (18, 9): textarea (18, 10): textarea (18, 11): textarea (18, 12): textarea (18, 13): textarea (18, 14): textarea (18, 15): textarea (18, 16): textarea (18, 17): textarea (18, 18): textarea (18, 19): textarea (18, 20): textarea (18, 21): Entry.field (18, 22): Entry.field (18, 23): Entry.field (18, 24): Entry.field (18, 25): Entry.field (18, 26): Entry.field (19, 0): Entry.field (19, 1): Entry.field (19, 2): Entry.field (19, 3): Entry.field (19, 4): Entry.field (19, 5): textarea (19, 6): textarea (19, 7): textarea (19, 8): textarea (19, 9): textarea (19, 10): textarea (19, 11): textarea (19, 12): textarea (19, 13): textarea (19, 14): textarea (19, 15): textarea (19, 16): textarea (19, 17): textarea (19, 18): textarea (19, 19): textarea (19, 20): textarea (19, 21): Entry.field (19, 22): Entry.field (19, 23): Entry.field (19, 24): Entry.field (19, 25): Entry.field (19, 26): Entry.field (20, 0): Entry.field (20, 1): Entry.field (20, 2): Entry.field (20, 3): Entry.field (20, 4): Entry.field (20, 5): textarea (20, 6): textarea (20, 7): textarea (20, 8): textarea (20, 9): textarea (20, 10): textarea (20, 11): textarea (20, 12): textarea (20, 13): textarea (20, 14): textarea (20, 15): textarea (20, 16): textarea (20, 17): textarea (20, 18): textarea (20, 19): textarea (20, 20): textarea (20, 21): Entry.field (20, 22): Entry.field (20, 23): Entry.field (20, 24): Entry.field (20, 25): Entry.field (20, 26): Entry.field (21, 0): Entry.field (21, 1): Entry.field (21, 2): Entry.field (21, 3): Entry.field (21, 4): Entry.field (21, 5): textarea (21, 6): textarea (21, 7): textarea (21, 8): textarea (21, 9): textarea (21, 10): textarea (21, 11): textarea (21, 12): textarea (21, 13): textarea (21, 14): textarea (21, 15): textarea (21, 16): textarea (21, 17): textarea (21, 18): textarea (21, 19): textarea (21, 20): textarea (21, 21): Entry.field (21, 22): Entry.field (21, 23): Entry.field (21, 24): Entry.field (21, 25): Entry.field (21, 26): Entry.field (22, 0): Entry.field (22, 1): Entry.field (22, 2): Entry.field (22, 3): Entry.field (22, 4): Entry.field (22, 5): textarea (22, 6): textarea (22, 7): textarea (22, 8): textarea (22, 9): textarea (22, 10): textarea (22, 11): textarea (22, 12): textarea (22, 13): textarea (22, 14): textarea (22, 15): textarea (22, 16): textarea (22, 17): textarea (22, 18): textarea (22, 19): textarea (22, 20): textarea (22, 21): Entry.field (22, 22): Entry.field (22, 23): Entry.field (22, 24): Entry.field (22, 25): Entry.field (22, 26): Entry.field (23, 0): Entry.field (23, 1): Entry.field (23, 2): Entry.field (23, 3): Entry.field (23, 4): Entry.field (23, 5): textarea (23, 6): textarea (23, 7): textarea (23, 8): textarea (23, 9): textarea (23, 10): textarea (23, 11): textarea (23, 12): textarea (23, 13): textarea (23, 14): textarea (23, 15): textarea (23, 16): textarea (23, 17): textarea (23, 18): textarea (23, 19): textarea (23, 20): textarea (23, 21): Entry.field (23, 22): Entry.field (23, 23): Entry.field (23, 24): Entry.field (23, 25): Entry.field (23, 26): Entry.field (24, 0): Entry.field (24, 1): Entry.field (24, 2): Entry.field (24, 3): Entry.field (24, 4): Entry.field (24, 5): textarea (24, 6): textarea (24, 7): textarea (24, 8): textarea (24, 9): textarea (24, 10): textarea (24, 11): textarea (24, 12): textarea (24, 13): textarea (24, 14): textarea (24, 15): textarea (24, 16): textarea (24, 17): textarea (24, 18): textarea (24, 19): textarea (24, 20): textarea (24, 21): Entry.field (24, 22): Entry.field (24, 23): Entry.field (24, 24): Entry.field (24, 25): Entry.field (24, 26): Entry.field (25, 0): Entry.field (25, 1): Entry.field (25, 2): Entry.field (25, 3): Entry.field (25, 4): Entry.field (25, 5): textarea (25, 6): textarea (25, 7): textarea (25, 8): textarea (25, 9): textarea (25, 10): textarea (25, 11): textarea (25, 12): textarea (25, 13): textarea (25, 14): textarea (25, 15): textarea (25, 16): textarea (25, 17): textarea (25, 18): textarea (25, 19): textarea (25, 20): textarea (25, 21): Entry.field (25, 22): Entry.field (25, 23): Entry.field (25, 24): Entry.field (25, 25): Entry.field (25, 26): Entry.field (26, 0): Entry.field (26, 1): Entry.field (26, 2): Entry.field (26, 3): Entry.field (26, 4): Entry.field (26, 5): textarea (26, 6): textarea (26, 7): textarea (26, 8): textarea (26, 9): textarea (26, 10): textarea (26, 11): textarea (26, 12): textarea (26, 13): textarea (26, 14): textarea (26, 15): textarea (26, 16): textarea (26, 17): textarea (26, 18): textarea (26, 19): textarea (26, 20): textarea (26, 21): Entry.field (26, 22): Entry.field (26, 23): Entry.field (26, 24): Entry.field (26, 25): Entry.field (26, 26): Entry.field (27, 0): Entry.field (27, 1): Entry.field (27, 2): Entry.field (27, 3): Entry.field (27, 4): Entry.field (27, 5): textarea (27, 6): textarea (27, 7): textarea (27, 8): textarea (27, 9): textarea (27, 10): textarea (27, 11): textarea (27, 12): textarea (27, 13): textarea (27, 14): textarea (27, 15): textarea (27, 16): textarea (27, 17): textarea (27, 18): textarea (27, 19): textarea (27, 20): textarea (27, 21): Entry.field (27, 22): Entry.field (27, 23): Entry.field (27, 24): Entry.field (27, 25): Entry.field (27, 26): Entry.field (28, 0): Entry.field (28, 1): Entry.field (28, 2): Entry.field (28, 3): Entry.field (28, 4): Entry.field (28, 5): textarea (28, 6): textarea (28, 7): textarea (28, 8): textarea (28, 9): textarea (28, 10): textarea (28, 11): textarea (28, 12): textarea (28, 13): textarea (28, 14): textarea (28, 15): textarea (28, 16): textarea (28, 17): textarea (28, 18): textarea (28, 19): textarea (28, 20): textarea (28, 21): Entry.field (28, 22): Entry.field (28, 23): Entry.field (28, 24): Entry.field (28, 25): Entry.field (28, 26): Entry.field (29, 0): Entry.field (29, 1): Entry.field (29, 2): Entry.field (29, 3): Entry.field (29, 4): Entry.field (29, 5): textarea (29, 6): textarea (29, 7): textarea (29, 8): textarea (29, 9): textarea (29, 10): textarea (29, 11): textarea (29, 12): textarea (29, 13): textarea (29, 14): textarea (29, 15): textarea (29, 16): textarea (29, 17): textarea (29, 18): textarea (29, 19): textarea (29, 20): textarea (29, 21): Entry.field (29, 22): Entry.field (29, 23): Entry.field (29, 24): Entry.field (29, 25): Entry.field (29, 26): Entry.field (30, 0): Entry.field (30, 1): Entry.field (30, 2): Entry.field (30, 3): Entry.field (30, 4): Entry.field (30, 5): textarea (30, 6): textarea (30, 7): textarea (30, 8): textarea (30, 9): textarea (30, 10): textarea (30, 11): textarea (30, 12): textarea (30, 13): textarea (30, 14): textarea (30, 15): textarea (30, 16): textarea (30, 17): textarea (30, 18): textarea (30, 19): textarea (30, 20): textarea (30, 21): Entry.field (30, 22): Entry.field (30, 23): Entry.field (30, 24): Entry.field (30, 25): Entry.field (30, 26): Entry.field (31, 0): Entry.field (31, 1): Entry.field (31, 2): Entry.field (31, 3): Entry.field (31, 4): Entry.field (31, 5): textarea (31, 6): textarea (31, 7): textarea (31, 8): textarea (31, 9): textarea (31, 10): textarea (31, 11): textarea (31, 12): textarea (31, 13): textarea (31, 14): textarea (31, 15): textarea (31, 16): textarea (31, 17): textarea (31, 18): textarea (31, 19): textarea (31, 20): textarea (31, 21): Entry.field (31, 22): Entry.field (31, 23): Entry.field (31, 24): Entry.field (31, 25): Entry.field (31, 26): Entry.field (32, 0): Entry.field (32, 1): Entry.field (32, 2): Entry.field (32, 3): Entry.field (32, 4): Entry.field (32, 5): textarea (32, 6): textarea (32, 7): textarea (32, 8): textarea (32, 9): textarea (32, 10): textarea (32, 11): textarea (32, 12): textarea (32, 13): textarea (32, 14): textarea (32, 15): textarea (32, 16): textarea (32, 17): textarea (32, 18): textarea (32, 19): textarea (32, 20): textarea (32, 21): Entry.field (32, 22): Entry.field (32, 23): Entry.field (32, 24): Entry.field (32, 25): Entry.field (32, 26): Entry.field (33, 0): Entry.field (33, 1): Entry.field (33, 2): Entry.field (33, 3): Entry.field (33, 4): Entry.field (33, 5): textarea (33, 6): textarea (33, 7): textarea (33, 8): textarea (33, 9): textarea (33, 10): textarea (33, 11): textarea (33, 12): textarea (33, 13): textarea (33, 14): textarea (33, 15): textarea (33, 16): textarea (33, 17): textarea (33, 18): textarea (33, 19): textarea (33, 20): textarea (33, 21): Entry.field (33, 22): Entry.field (33, 23): Entry.field (33, 24): Entry.field (33, 25): Entry.field (33, 26): Entry.field (34, 0): Entry.field (34, 1): Entry.field (34, 2): Entry.field (34, 3): Entry.field (34, 4): Entry.field (34, 5): textarea (34, 6): textarea (34, 7): textarea (34, 8): textarea (34, 9): textarea (34, 10): textarea (34, 11): textarea (34, 12): textarea (34, 13): textarea (34, 14): textarea (34, 15): textarea (34, 16): textarea (34, 17): textarea (34, 18): textarea (34, 19): textarea (34, 20): textarea (34, 21): Entry.field (34, 22): Entry.field (34, 23): Entry.field (34, 24): Entry.field (34, 25): Entry.field (34, 26): Entry.field (35, 0): Entry.field (35, 1): Entry.field (35, 2): Entry.field (35, 3): Entry.field (35, 4): Entry.field (35, 5): textarea (35, 6): textarea (35, 7): textarea (35, 8): textarea (35, 9): textarea (35, 10): textarea (35, 11): textarea (35, 12): textarea (35, 13): textarea (35, 14): textarea (35, 15): textarea (35, 16): textarea (35, 17): textarea (35, 18): textarea (35, 19): textarea (35, 20): textarea (35, 21): Entry.field (35, 22): Entry.field (35, 23): Entry.field (35, 24): Entry.field (35, 25): Entry.field (35, 26): Entry.field (36, 0): Entry.field (36, 1): Entry.field (36, 2): Entry.field (36, 3): Entry.field (36, 4): Entry.field (36, 5): textarea (36, 6): textarea (36, 7): textarea (36, 8): textarea (36, 9): textarea (36, 10): textarea (36, 11): textarea (36, 12): textarea (36, 13): textarea (36, 14): textarea (36, 15): textarea (36, 16): textarea (36, 17): textarea (36, 18): textarea (36, 19): textarea (36, 20): textarea (36, 21): Entry.field (36, 22): Entry.field (36, 23): Entry.field (36, 24): Entry.field (36, 25): Entry.field (36, 26): Entry.field (37, 0): Entry.field (37, 1): Entry.field (37, 2): Entry.field (37, 3): Entry.field (37, 4): Entry.field (37, 5): textarea (37, 6): textarea (37, 7): textarea (37, 8): textarea (37, 9): textarea (37, 10): textarea (37, 11): textarea (37, 12): textarea (37, 13): textarea (37, 14): textarea (37, 15): textarea (37, 16): textarea (37, 17): textarea (37, 18): textarea (37, 19): textarea (37, 20): textarea (37, 21): Entry.field (37, 22): Entry.field (37, 23): Entry.field (37, 24): Entry.field (37, 25): Entry.field (37, 26): Entry.field (38, 0): Entry.field (38, 1): Entry.field (38, 2): Entry.field (38, 3): Entry.field (38, 4): Entry.field (38, 5): textarea (38, 6): textarea (38, 7): textarea (38, 8): textarea (38, 9): textarea (38, 10): textarea (38, 11): textarea (38, 12): textarea (38, 13): textarea (38, 14): textarea (38, 15): textarea (38, 16): textarea (38, 17): textarea (38, 18): textarea (38, 19): textarea (38, 20): textarea (38, 21): Entry.field (38, 22): Entry.field (38, 23): Entry.field (38, 24): Entry.field (38, 25): Entry.field (38, 26): Entry.field (39, 0): Entry.field (39, 1): Entry.field (39, 2): Entry.field (39, 3): Entry.field (39, 4): Entry.field (39, 5): textarea (39, 6): textarea (39, 7): textarea (39, 8): textarea (39, 9): textarea (39, 10): textarea (39, 11): textarea (39, 12): textarea (39, 13): textarea (39, 14): textarea (39, 15): textarea (39, 16): textarea (39, 17): textarea (39, 18): textarea (39, 19): textarea (39, 20): textarea (39, 21): Entry.field (39, 22): Entry.field (39, 23): Entry.field (39, 24): Entry.field (39, 25): Entry.field (39, 26): Entry.field (40, 0): Entry.field (40, 1): Entry.field (40, 2): Entry.field (40, 3): Entry.field (40, 4): Entry.field (40, 5): textarea (40, 6): textarea (40, 7): textarea (40, 8): textarea (40, 9): textarea (40, 10): textarea (40, 11): textarea (40, 12): textarea (40, 13): textarea (40, 14): textarea (40, 15): textarea (40, 16): textarea (40, 17): textarea (40, 18): textarea (40, 19): textarea (40, 20): textarea (40, 21): Entry.field (40, 22): Entry.field (40, 23): Entry.field (40, 24): Entry.field (40, 25): Entry.field (40, 26): Entry.field (41, 0): Entry.field (41, 1): Entry.field (41, 2): Entry.field (41, 3): Entry.field (41, 4): Entry.field (41, 5): textarea (41, 6): textarea (41, 7): textarea (41, 8): textarea (41, 9): textarea (41, 10): textarea (41, 11): textarea (41, 12): textarea (41, 13): textarea (41, 14): textarea (41, 15): textarea (41, 16): textarea (41, 17): textarea (41, 18): textarea (41, 19): textarea (41, 20): textarea (41, 21): Entry.field (41, 22): Entry.field (41, 23): Entry.field (41, 24): Entry.field (41, 25): Entry.field (41, 26): Entry.field (42, 0): Entry.field (42, 1): Entry.field (42, 2): Entry.field (42, 3): Entry.field (42, 4): Entry.field (42, 5): textarea (42, 6): textarea (42, 7): textarea (42, 8): textarea (42, 9): textarea (42, 10): textarea (42, 11): textarea (42, 12): textarea (42, 13): textarea (42, 14): textarea (42, 15): textarea (42, 16): textarea (42, 17): textarea (42, 18): textarea (42, 19): textarea (42, 20): textarea (42, 21): Entry.field (42, 22): Entry.field (42, 23): Entry.field (42, 24): Entry.field (42, 25): Entry.field (42, 26): Entry.field (43, 0): Entry.field (43, 1): Entry.field (43, 2): Entry.field (43, 3): Entry.field (43, 4): Entry.field (43, 5): textarea (43, 6): textarea (43, 7): textarea (43, 8): textarea (43, 9): textarea (43, 10): textarea (43, 11): textarea (43, 12): textarea (43, 13): textarea (43, 14): textarea (43, 15): textarea (43, 16): textarea (43, 17): textarea (43, 18): textarea (43, 19): textarea (43, 20): textarea (43, 21): Entry.field (43, 22): Entry.field (43, 23): Entry.field (43, 24): Entry.field (43, 25): Entry.field (43, 26): Entry.field (44, 0): Entry.field (44, 1): Entry.field (44, 2): Entry.field (44, 3): Entry.field (44, 4): Entry.field (44, 5): textarea (44, 6): textarea (44, 7): textarea (44, 8): textarea (44, 9): textarea (44, 10): textarea (44, 11): textarea (44, 12): textarea (44, 13): textarea (44, 14): textarea (44, 15): textarea (44, 16): textarea (44, 17): textarea (44, 18): textarea (44, 19): textarea (44, 20): textarea (44, 21): Entry.field (44, 22): Entry.field (44, 23): Entry.field (44, 24): Entry.field (44, 25): Entry.field (44, 26): Entry.field (45, 0): Entry.field (45, 1): Entry.field (45, 2): Entry.field (45, 3): Entry.field (45, 4): Entry.field (45, 5): textarea (45, 6): textarea (45, 7): textarea (45, 8): textarea (45, 9): textarea (45, 10): textarea (45, 11): textarea (45, 12): textarea (45, 13): textarea (45, 14): textarea (45, 15): textarea (45, 16): textarea (45, 17): textarea (45, 18): textarea (45, 19): textarea (45, 20): textarea (45, 21): Entry.field (45, 22): Entry.field (45, 23): Entry.field (45, 24): Entry.field (45, 25): Entry.field (45, 26): Entry.field (46, 0): Entry.field (46, 1): Entry.field (46, 2): Entry.field (46, 3): Entry.field (46, 4): Entry.field (46, 5): textarea (46, 6): textarea (46, 7): textarea (46, 8): textarea (46, 9): textarea (46, 10): textarea (46, 11): textarea (46, 12): textarea (46, 13): textarea (46, 14): textarea (46, 15): textarea (46, 16): textarea (46, 17): textarea (46, 18): textarea (46, 19): textarea (46, 20): textarea (46, 21): Entry.field (46, 22): Entry.field (46, 23): Entry.field (46, 24): Entry.field (46, 25): Entry.field (46, 26): Entry.field (47, 0): Entry.field (47, 1): Entry.field (47, 2): Entry.field (47, 3): Entry.field (47, 4): Entry.field (47, 5): textarea (47, 6): textarea (47, 7): textarea (47, 8): textarea (47, 9): textarea (47, 10): textarea (47, 11): textarea (47, 12): textarea (47, 13): textarea (47, 14): textarea (47, 15): textarea (47, 16): textarea (47, 17): textarea (47, 18): textarea (47, 19): textarea (47, 20): textarea (47, 21): Entry.field (47, 22): Entry.field (47, 23): Entry.field (47, 24): Entry.field (47, 25): Entry.field (47, 26): Entry.field (48, 0): Entry.field (48, 1): Entry.field (48, 2): Entry.field (48, 3): Entry.field (48, 4): Entry.field (48, 5): textarea (48, 6): textarea (48, 7): textarea (48, 8): textarea (48, 9): textarea (48, 10): textarea (48, 11): textarea (48, 12): textarea (48, 13): textarea (48, 14): textarea (48, 15): textarea (48, 16): textarea (48, 17): textarea (48, 18): textarea (48, 19): textarea (48, 20): textarea (48, 21): Entry.field (48, 22): Entry.field (48, 23): Entry.field (48, 24): Entry.field (48, 25): Entry.field (48, 26): Entry.field (49, 0): Entry.field (49, 1): Entry.field (49, 2): Entry.field (49, 3): Entry.field (49, 4): Entry.field (49, 5): textarea (49, 6): textarea (49, 7): textarea (49, 8): textarea (49, 9): textarea (49, 10): textarea (49, 11): textarea (49, 12): textarea (49, 13): textarea (49, 14): textarea (49, 15): textarea (49, 16): textarea (49, 17): textarea (49, 18): textarea (49, 19): textarea (49, 20): textarea (49, 21): Entry.field (49, 22): Entry.field (49, 23): Entry.field (49, 24): Entry.field (49, 25): Entry.field (49, 26): Entry.field ``` One way to silence the test failure is to probe the widget at a different location: diff --git a/Lib/test/test_ttk/test_widgets.py b/Lib/test/test_ttk/test_widgets.py
index fd1a748a49..407bd1bb4b 100644
--- a/Lib/test/test_ttk/test_widgets.py
+++ b/Lib/test/test_ttk/test_widgets.py
@@ -341,7 +341,7 @@ def test_identify(self):
self.entry.update()
# bpo-27313: macOS Cocoa widget differs from X, allow either
- self.assertEqual(self.entry.identify(5, 5), self.IDENTIFY_AS)
+ self.assertEqual(self.entry.identify(1, 1), self.IDENTIFY_AS)
self.assertEqual(self.entry.identify(-1, -1), "")
self.assertRaises(tkinter.TclError, self.entry.identify, None, 5) Again, I'm a Tkinter newby and don't understand what I'm doing here, and also don't know what this tries to test. |
I get the same 2 failures running test_ttk either way ( |
It is easy enough to change the test code to avoid these failures, but because I'm not familiar with Tkinter I need some guidance on what the identify method is supposed to do. Two "obvious" changes:
|
I can verify both the |
Please test also the following patch. For some reasons I think that it may be safer to create a new layout than modify an existing layout. diff --git a/Lib/test/test_ttk/test_style.py b/Lib/test/test_ttk/test_style.py
index 9a04a95dc40..8b1993c8950 100644
--- a/Lib/test/test_ttk/test_style.py
+++ b/Lib/test/test_ttk/test_style.py
@@ -227,13 +227,13 @@ def test_element_create_image(self):
foreground='blue', background='yellow')
img3 = tkinter.BitmapImage(master=self.root, file=imgfile,
foreground='white', background='black')
- style.element_create('Button.button', 'image',
+ style.element_create('TestButton1.button', 'image',
img1, ('pressed', img2), ('active', img3),
border=(2, 4), sticky='we')
- self.assertIn('Button.button', style.element_names())
+ self.assertIn('TestButton1.button', style.element_names())
- style.layout('Button', [('Button.button', {'sticky': 'news'})])
- b = ttk.Button(self.root, style='Button')
+ style.layout('TestButton1', [('TestButton1.button', {'sticky': 'news'})])
+ b = ttk.Button(self.root, style='TestButton1')
b.pack(expand=True, fill='both')
self.assertEqual(b.winfo_reqwidth(), 16)
self.assertEqual(b.winfo_reqheight(), 16) |
@serhiy-storchaka, I agree that amending the test by creating a new layout is a better solution. |
I merged a variant of Serhiy's suggestion; thanks all! |
FTR, |
Ronald:
@serhiy-storchaka, any thoughts regarding Ronald's suggestion for (FTR, I'm unable to reproduce the |
Nah, the patch from #86673 (comment) does not make things better :( |
See also #71500. |
The IOW, something a la this: diff --git a/Lib/test/test_ttk/test_widgets.py b/Lib/test/test_ttk/test_widgets.py
index 88740b18864..2b22ed75f27 100644
--- a/Lib/test/test_ttk/test_widgets.py
+++ b/Lib/test/test_ttk/test_widgets.py
@@ -336,7 +336,7 @@ class EntryTest(AbstractWidgetTest, unittest.TestCase):
'show', 'state', 'style', 'takefocus', 'textvariable',
'validate', 'validatecommand', 'width', 'xscrollcommand',
)
- IDENTIFY_AS = 'Entry.field' if sys.platform == 'darwin' else 'textarea'
+ IDENTIFY_AS = {'Entry.field', 'textarea'}
def setUp(self):
super().setUp()
@@ -374,7 +374,7 @@ def test_identify(self):
self.entry.update()
# bpo-27313: macOS Cocoa widget differs from X, allow either
- self.assertEqual(self.entry.identify(5, 5), self.IDENTIFY_AS)
+ self.assertIn(self.entry.identify(5, 5), self.IDENTIFY_AS)
self.assertEqual(self.entry.identify(-1, -1), "")
self.assertRaises(tkinter.TclError, self.entry.identify, None, 5)
@@ -461,7 +461,7 @@ class ComboboxTest(EntryTest, unittest.TestCase):
'validate', 'validatecommand', 'values',
'width', 'xscrollcommand',
)
- IDENTIFY_AS = 'Combobox.button' if sys.platform == 'darwin' else 'textarea'
+ IDENTIFY_AS = {'Combobox.button', 'textarea'}
def setUp(self):
super().setUp()
@@ -1204,7 +1204,7 @@ class SpinboxTest(EntryTest, unittest.TestCase):
'takefocus', 'textvariable', 'to', 'validate', 'validatecommand',
'values', 'width', 'wrap', 'xscrollcommand',
)
- IDENTIFY_AS = 'Spinbox.field' if sys.platform == 'darwin' else 'textarea'
+ IDENTIFY_AS = {'Spinbox.field', 'textarea'}
def setUp(self):
super().setUp()
|
In aeca373 (PR pythongh-12011, issue pythongh-71500), test_identify() was changed to expect different results on Darwin. This workaround is only needed for some variants of Tk/Tcl on macOS, so we now allow both the workaround and the generic results for these tests.
…H-125335) In aeca373 (PR pythongh-12011, issue pythongh-71500), test_identify() was changed to expect different results on Darwin. Ned's fix was later adjusted by e52f9be. This workaround is only needed for some variants of Tk/Tcl on macOS, so we now allow both the workaround and the generic results for these tests. (cherry picked from commit 4197a79) Co-authored-by: Erlend E. Aasland <erlend@python.org>
…H-125335) In aeca373 (PR pythongh-12011, issue pythongh-71500), test_identify() was changed to expect different results on Darwin. Ned's fix was later adjusted by e52f9be. This workaround is only needed for some variants of Tk/Tcl on macOS, so we now allow both the workaround and the generic results for these tests. (cherry picked from commit 4197a79) Co-authored-by: Erlend E. Aasland <erlend@python.org>
) (#125391) In aeca373 (PR gh-12011, issue gh-71500), test_identify() was changed to expect different results on Darwin. Ned's fix was later adjusted by e52f9be. This workaround is only needed for some variants of Tk/Tcl on macOS, so we now allow both the workaround and the generic results for these tests. (cherry picked from commit 4197a79) Co-authored-by: Erlend E. Aasland <erlend@python.org>
) (#125390) In aeca373 (PR gh-12011, issue gh-71500), test_identify() was changed to expect different results on Darwin. Ned's fix was later adjusted by e52f9be. This workaround is only needed for some variants of Tk/Tcl on macOS, so we now allow both the workaround and the generic results for these tests. (cherry picked from commit 4197a79) Co-authored-by: Erlend E. Aasland <erlend@python.org>
I believe we can close this; thanks to everyone involved. |
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:
Linked PRs
test_ttk.test_element_create_image
#123335test_ttk.test_element_create_image
(GH-123335) #124654test_ttk.test_element_create_image
(GH-123335) #124655The text was updated successfully, but these errors were encountered: