summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter/test/support.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-11-09 19:16:19 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-11-09 19:16:19 (GMT)
commitaffb9b255bffd032e90dc9e3a73f5053cdd0cd61 (patch)
tree109e6609c74e1b26ed73caf8016138594da52925 /Lib/tkinter/test/support.py
parent2915933f4f95f2c3fe12074031585e15e9285d52 (diff)
downloadcpython-affb9b255bffd032e90dc9e3a73f5053cdd0cd61.zip
cpython-affb9b255bffd032e90dc9e3a73f5053cdd0cd61.tar.gz
cpython-affb9b255bffd032e90dc9e3a73f5053cdd0cd61.tar.bz2
Fix Tkinter tests on Tk 8.5 with patchlevel < 8.5.11 (issue #19085).
Diffstat (limited to 'Lib/tkinter/test/support.py')
-rw-r--r--Lib/tkinter/test/support.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/tkinter/test/support.py b/Lib/tkinter/test/support.py
index 8fd0beb..fcd9ffc 100644
--- a/Lib/tkinter/test/support.py
+++ b/Lib/tkinter/test/support.py
@@ -86,6 +86,21 @@ def requires_tcl(*version):
return unittest.skipUnless(tcl_version >= version,
'requires Tcl version >= ' + '.'.join(map(str, version)))
+_tk_patchlevel = None
+def get_tk_patchlevel():
+ global _tk_patchlevel
+ if _tk_patchlevel is None:
+ tcl = tkinter.Tcl()
+ patchlevel = []
+ for x in tcl.call('info', 'patchlevel').split('.'):
+ try:
+ x = int(x, 10)
+ except ValueError:
+ x = -1
+ patchlevel.append(x)
+ _tk_patchlevel = tuple(patchlevel)
+ return _tk_patchlevel
+
units = {
'c': 72 / 2.54, # centimeters
'i': 72, # inches