summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter/test/support.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-11-09 19:17:37 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-11-09 19:17:37 (GMT)
commit35ac05eb4c3e0c8be309030cf179897de287e4b3 (patch)
treefdc1edfd836f492d61255d0a3757769d5f9ee44c /Lib/tkinter/test/support.py
parent86e83a03470143e6996dc74c99d50904f99e9454 (diff)
parentaffb9b255bffd032e90dc9e3a73f5053cdd0cd61 (diff)
downloadcpython-35ac05eb4c3e0c8be309030cf179897de287e4b3.zip
cpython-35ac05eb4c3e0c8be309030cf179897de287e4b3.tar.gz
cpython-35ac05eb4c3e0c8be309030cf179897de287e4b3.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