[Python-checkins] cpython (2.7): Issue #19085: Fix running test_ttk_textonly on displayless host.
serhiy.storchaka
python-checkins at python.org
Mon Nov 4 22:07:26 CET 2013
http://hg.python.org/cpython/rev/fe7aaf14b129
changeset: 86926:fe7aaf14b129
branch: 2.7
parent: 86923:c3fa22d04fb2
user: Serhiy Storchaka <storchaka at gmail.com>
date: Mon Nov 04 23:05:23 2013 +0200
summary:
Issue #19085: Fix running test_ttk_textonly on displayless host.
files:
Lib/lib-tk/test/test_tkinter/test_widgets.py | 5 +-
Lib/lib-tk/test/widget_tests.py | 18 ++++++---
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/Lib/lib-tk/test/test_tkinter/test_widgets.py b/Lib/lib-tk/test/test_tkinter/test_widgets.py
--- a/Lib/lib-tk/test/test_tkinter/test_widgets.py
+++ b/Lib/lib-tk/test/test_tkinter/test_widgets.py
@@ -4,7 +4,8 @@
from test.test_support import requires, run_unittest
from test_ttk.support import tcl_version, requires_tcl, widget_eq
-from widget_tests import (add_standard_options, noconv, noconv_meth, int_round,
+from widget_tests import (
+ add_standard_options, noconv, noconv_meth, int_round, pixels_round,
AbstractWidgetTest, StandardOptionsTests,
IntegerSizeTests, PixelSizeTests)
@@ -240,7 +241,7 @@
'takefocus', 'text', 'textvariable',
'underline', 'width', 'wraplength',
)
- _conv_pixels = staticmethod(AbstractWidgetTest._conv_pixels)
+ _conv_pixels = staticmethod(pixels_round)
def _create(self, **kwargs):
return Tkinter.Menubutton(self.root, **kwargs)
diff --git a/Lib/lib-tk/test/widget_tests.py b/Lib/lib-tk/test/widget_tests.py
--- a/Lib/lib-tk/test/widget_tests.py
+++ b/Lib/lib-tk/test/widget_tests.py
@@ -15,12 +15,18 @@
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()
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list