Skip to content

Commit

Permalink
bpo-34189: Fix checking for bugfix Tcl version. (pythonGH-8397)
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiy-storchaka committed Jul 22, 2018
1 parent e271ca7 commit c75c1e0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
14 changes: 13 additions & 1 deletion Lib/tkinter/test/support.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import functools
import re
import tkinter
import unittest
Expand Down Expand Up @@ -54,9 +55,20 @@ def simulate_mouse_click(widget, x, y):
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
Expand Down
4 changes: 1 addition & 3 deletions Lib/tkinter/test/test_tkinter/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,9 +717,7 @@ def test_activestyle(self):
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()
Expand Down

0 comments on commit c75c1e0

Please sign in to comment.