Skip to content

Commit c75c1e0

Browse files
bpo-34189: Fix checking for bugfix Tcl version. (GH-8397)
1 parent e271ca7 commit c75c1e0

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

Lib/tkinter/test/support.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import functools
12
import re
23
import tkinter
34
import unittest
@@ -54,9 +55,20 @@ def simulate_mouse_click(widget, x, y):
5455
tcl_version = tuple(map(int, _tkinter.TCL_VERSION.split('.')))
5556

5657
def requires_tcl(*version):
57-
return unittest.skipUnless(tcl_version >= version,
58+
if len(version) <= 2:
59+
return unittest.skipUnless(tcl_version >= version,
5860
'requires Tcl version >= ' + '.'.join(map(str, version)))
5961

62+
def deco(test):
63+
@functools.wraps(test)
64+
def newtest(self):
65+
if get_tk_patchlevel() < (8, 6, 5):
66+
self.skipTest('requires Tcl version >= ' +
67+
'.'.join(map(str, get_tk_patchlevel())))
68+
test(self)
69+
return newtest
70+
return deco
71+
6072
_tk_patchlevel = None
6173
def get_tk_patchlevel():
6274
global _tk_patchlevel

Lib/tkinter/test/test_tkinter/test_widgets.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -717,9 +717,7 @@ def test_activestyle(self):
717717
self.checkEnumParam(widget, 'activestyle',
718718
'dotbox', 'none', 'underline')
719719

720-
@requires_tcl(8, 6, 5)
721-
def test_justify(self):
722-
AbstractWidgetTest.test_justify(self)
720+
test_justify = requires_tcl(8, 6, 5)(StandardOptionsTests.test_justify)
723721

724722
def test_listvariable(self):
725723
widget = self.create()

0 commit comments

Comments
 (0)