summaryrefslogtreecommitdiffstats
path: root/Lib/lib-tk
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-04-22 05:35:53 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-04-22 05:35:53 (GMT)
commitdcb12f46d10b357fd769cd157e2e9786ad7286cc (patch)
treef822dea2a787ee64eb6fbfad39f9382498156347 /Lib/lib-tk
parent656ffdb4de47e462eb4c94377a930511c245fd7b (diff)
downloadcpython-dcb12f46d10b357fd769cd157e2e9786ad7286cc.zip
cpython-dcb12f46d10b357fd769cd157e2e9786ad7286cc.tar.gz
cpython-dcb12f46d10b357fd769cd157e2e9786ad7286cc.tar.bz2
Fixed full Tcl version parsing in tests for pre-final versions.
Diffstat (limited to 'Lib/lib-tk')
-rw-r--r--Lib/lib-tk/test/test_ttk/support.py18
-rw-r--r--Lib/lib-tk/test/test_ttk/test_widgets.py4
2 files changed, 12 insertions, 10 deletions
diff --git a/Lib/lib-tk/test/test_ttk/support.py b/Lib/lib-tk/test/test_ttk/support.py
index c335f29..91795d9 100644
--- a/Lib/lib-tk/test/test_ttk/support.py
+++ b/Lib/lib-tk/test/test_ttk/support.py
@@ -1,3 +1,4 @@
+import re
import unittest
import Tkinter as tkinter
@@ -61,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.match(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/lib-tk/test/test_ttk/test_widgets.py b/Lib/lib-tk/test/test_ttk/test_widgets.py
index 6848905..71de83f 100644
--- a/Lib/lib-tk/test/test_ttk/test_widgets.py
+++ b/Lib/lib-tk/test/test_ttk/test_widgets.py
@@ -22,7 +22,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')
@@ -553,7 +553,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)