Skip to content

Commit d8e0806

Browse files
committed
Issue #10736: Fix test_ttk test_widgets failures with Cocoa Tk 8.5.9
on Mac OS X. (Patch by Ronald Oussoren)
1 parent 65f7db3 commit d8e0806

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

Lib/tkinter/test/test_ttk/test_widgets.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
from tkinter import ttk
55
from test.support import requires, run_unittest
6+
import sys
67

78
import tkinter.test.support as support
89
from tkinter.test.test_ttk.test_functions import MockTclObj, MockStateSpec
@@ -561,11 +562,19 @@ def test_tab_identifiers(self):
561562

562563
self.nb.pack()
563564
self.nb.wait_visibility()
564-
self.assertEqual(self.nb.tab('@5,5'), self.nb.tab('current'))
565+
if sys.platform == 'darwin':
566+
tb_idx = "@20,5"
567+
else:
568+
tb_idx = "@5,5"
569+
self.assertEqual(self.nb.tab(tb_idx), self.nb.tab('current'))
565570

566571
for i in range(5, 100, 5):
567-
if self.nb.tab('@%d, 5' % i, text=None) == 'a':
568-
break
572+
try:
573+
if self.nb.tab('@%d, 5' % i, text=None) == 'a':
574+
break
575+
except tkinter.TclError:
576+
pass
577+
569578
else:
570579
self.fail("Tab with text 'a' not found")
571580

@@ -722,7 +731,10 @@ def test_traversal(self):
722731
self.nb.enable_traversal()
723732
self.nb.focus_force()
724733
support.simulate_mouse_click(self.nb, 5, 5)
725-
self.nb.event_generate('<Alt-a>')
734+
if sys.platform == 'darwin':
735+
self.nb.event_generate('<Option-a>')
736+
else:
737+
self.nb.event_generate('<Alt-a>')
726738
self.assertEqual(self.nb.select(), str(self.child1))
727739

728740

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,9 @@ Extension Modules
770770
Tests
771771
-----
772772

773+
- Issue #10736: Fix test_ttk test_widgets failures with Cocoa Tk 8.5.9
774+
on Mac OS X. (Patch by Ronald Oussoren)
775+
773776
- Issue #12180: Fixed a few remaining errors in test_packaging when no
774777
threading.
775778

0 commit comments

Comments
 (0)