summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter/test
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-04-22 05:36:41 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-04-22 05:36:41 (GMT)
commitaec050919344b9272f260b6275523cfb3abd1e41 (patch)
treefb82d940be22625d4f83662d79e5ecd4ff0fed20 /Lib/tkinter/test
parentc3a7f181008fef91b5a5977b370271ce3f7f75b0 (diff)
parent462c357d70cf499f82349c6839c624e4f3026a49 (diff)
downloadcpython-aec050919344b9272f260b6275523cfb3abd1e41.zip
cpython-aec050919344b9272f260b6275523cfb3abd1e41.tar.gz
cpython-aec050919344b9272f260b6275523cfb3abd1e41.tar.bz2
Fixed full Tcl version parsing in tests for pre-final versions.
Diffstat (limited to 'Lib/tkinter/test')
-rw-r--r--Lib/tkinter/test/support.py20
-rw-r--r--Lib/tkinter/test/test_ttk/test_widgets.py4
2 files changed, 12 insertions, 12 deletions
diff --git a/Lib/tkinter/test/support.py b/Lib/tkinter/test/support.py
index 067fc71..52df104 100644
--- a/Lib/tkinter/test/support.py
+++ b/Lib/tkinter/test/support.py
@@ -1,7 +1,6 @@
-import sys
+import re
import tkinter
import unittest
-from test.support import requires
class AbstractTkTest:
@@ -63,14 +62,15 @@ 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)
+ patchlevel = tcl.call('info', 'patchlevel')
+ m = re.fullmatch(r'(\d+)\.(\d+)([ab.])(\d+)', patchlevel)
+ major, minor, releaselevel, serial = m.groups()
+ major, minor, serial = int(major), int(minor), int(serial)
+ releaselevel = {'a': 'alpha', 'b': 'beta', '.': 'final'}[releaselevel]
+ if releaselevel == 'final':
+ _tk_patchlevel = major, minor, serial, releaselevel, 0
+ else:
+ _tk_patchlevel = major, minor, 0, releaselevel, serial
return _tk_patchlevel
units = {
diff --git a/Lib/tkinter/test/test_ttk/test_widgets.py b/Lib/tkinter/test/test_ttk/test_widgets.py
index 8a27324..9153c00 100644
--- a/Lib/tkinter/test/test_ttk/test_widgets.py
+++ b/Lib/tkinter/test/test_ttk/test_widgets.py
@@ -20,7 +20,7 @@ class StandardTtkOptionsTests(StandardOptionsTests):
widget = self.create()
self.assertEqual(widget['class'], '')
errmsg='attempt to change read-only option'
- if get_tk_patchlevel() < (8, 6, 0): # actually this was changed in 8.6b3
+ if get_tk_patchlevel() < (8, 6, 0, 'beta', 3):
errmsg='Attempt to change read-only option'
self.checkInvalidParam(widget, 'class', 'Foo', errmsg=errmsg)
widget2 = self.create(class_='Foo')
@@ -551,7 +551,7 @@ class PanedWindowTest(AbstractWidgetTest, unittest.TestCase):
widget = self.create()
self.assertEqual(str(widget['orient']), 'vertical')
errmsg='attempt to change read-only option'
- if get_tk_patchlevel() < (8, 6, 0): # actually this was changed in 8.6b3
+ if get_tk_patchlevel() < (8, 6, 0, 'beta', 3):
errmsg='Attempt to change read-only option'
self.checkInvalidParam(widget, 'orient', 'horizontal',
errmsg=errmsg)