]> granicus.if.org Git - python/commitdiff
bpo-34189: Fix checking for bugfix Tcl version. (GH-8397)
authorSerhiy Storchaka <storchaka@gmail.com>
Sun, 22 Jul 2018 18:41:48 +0000 (21:41 +0300)
committerGitHub <noreply@github.com>
Sun, 22 Jul 2018 18:41:48 +0000 (21:41 +0300)
Lib/tkinter/test/support.py
Lib/tkinter/test/test_tkinter/test_widgets.py

index dd155fad0fd0b3c97f8067938de33d878ce770c6..0d9a65a5cc830288e61cb51848b3337363da7bd1 100644 (file)
@@ -1,3 +1,4 @@
+import functools
 import re
 import tkinter
 import unittest
@@ -54,9 +55,20 @@ import _tkinter
 tcl_version = tuple(map(int, _tkinter.TCL_VERSION.split('.')))
 
 def requires_tcl(*version):
-    return unittest.skipUnless(tcl_version >= version,
+    if len(version) <= 2:
+        return unittest.skipUnless(tcl_version >= version,
             'requires Tcl version >= ' + '.'.join(map(str, version)))
 
+    def deco(test):
+        @functools.wraps(test)
+        def newtest(self):
+            if get_tk_patchlevel() < (8, 6, 5):
+                self.skipTest('requires Tcl version >= ' +
+                                '.'.join(map(str, get_tk_patchlevel())))
+            test(self)
+        return newtest
+    return deco
+
 _tk_patchlevel = None
 def get_tk_patchlevel():
     global _tk_patchlevel
index cd2a380793aadf0db9345ba778b895049bade16f..e4c9d337ba7d2b1652d32281c7cda8fa96449ab4 100644 (file)
@@ -717,9 +717,7 @@ class ListboxTest(AbstractWidgetTest, unittest.TestCase):
         self.checkEnumParam(widget, 'activestyle',
                             'dotbox', 'none', 'underline')
 
-    @requires_tcl(8, 6, 5)
-    def test_justify(self):
-        AbstractWidgetTest.test_justify(self)
+    test_justify = requires_tcl(8, 6, 5)(StandardOptionsTests.test_justify)
 
     def test_listvariable(self):
         widget = self.create()