summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter/test/widget_tests.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-11-04 21:05:37 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-11-04 21:05:37 (GMT)
commit2028e0131396258d7aa5052304863e7ca5af6ab9 (patch)
treeb3503485e8024f27710b8ad6c7aeea478a6c29cb /Lib/tkinter/test/widget_tests.py
parent8d8599ce0cc6b7ec2b7e1c43fc7f59b103ee7fe9 (diff)
downloadcpython-2028e0131396258d7aa5052304863e7ca5af6ab9.zip
cpython-2028e0131396258d7aa5052304863e7ca5af6ab9.tar.gz
cpython-2028e0131396258d7aa5052304863e7ca5af6ab9.tar.bz2
Issue #19085: Fix running test_ttk_textonly on displayless host.
Diffstat (limited to 'Lib/tkinter/test/widget_tests.py')
-rw-r--r--Lib/tkinter/test/widget_tests.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/Lib/tkinter/test/widget_tests.py b/Lib/tkinter/test/widget_tests.py
index 28cc986..e488565 100644
--- a/Lib/tkinter/test/widget_tests.py
+++ b/Lib/tkinter/test/widget_tests.py
@@ -12,18 +12,24 @@ pixels_round = round
if tcl_version[:2] == (8, 5):
# Issue #19085: Workaround a bug in Tk
# http://core.tcl.tk/tk/info/3497848
- root = setup_master()
- patchlevel = root.call('info', 'patchlevel')
- patchlevel = tuple(map(int, patchlevel.split('.')))
- if patchlevel < (8, 5, 12):
- pixels_round = int
- del root
+ _pixels_round = None
+ def pixels_round(x):
+ global _pixels_round
+ if _pixels_round is None:
+ root = setup_master()
+ patchlevel = root.call('info', 'patchlevel')
+ patchlevel = tuple(map(int, patchlevel.split('.')))
+ if patchlevel < (8, 5, 12):
+ _pixels_round = int
+ else:
+ _pixels_round = int_round
+ return _pixels_round(x)
_sentinel = object()
class AbstractWidgetTest:
- _conv_pixels = pixels_round
+ _conv_pixels = staticmethod(pixels_round)
_conv_pad_pixels = None
wantobjects = True