summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-08-24 06:07:47 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-08-24 06:07:47 (GMT)
commitd00aff2f62481c3e8cf3b8e9cbbaf888361ffdd4 (patch)
treeb76421157985cf86b00a39f3b652765667d96adb /Lib/test
parentee558260727d160d43b14fc01851f73ef94ea587 (diff)
downloadcpython-d00aff2f62481c3e8cf3b8e9cbbaf888361ffdd4.zip
cpython-d00aff2f62481c3e8cf3b8e9cbbaf888361ffdd4.tar.gz
cpython-d00aff2f62481c3e8cf3b8e9cbbaf888361ffdd4.tar.bz2
Issue #22236: Tkinter tests now don't reuse default root window. New root
window is created for every test class. Fixed Tkinter images copying operations in NoDefaultRoot mode. Tcl command names generated for "after" callbacks now contains a name of original function.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_ttk_guionly.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/Lib/test/test_ttk_guionly.py b/Lib/test/test_ttk_guionly.py
index e7a654f..fcdedac 100644
--- a/Lib/test/test_ttk_guionly.py
+++ b/Lib/test/test_ttk_guionly.py
@@ -6,7 +6,7 @@ from test import support
support.import_module('_tkinter')
# Make sure tkinter._fix runs to set up the environment
-support.import_fresh_module('tkinter')
+tkinter = support.import_fresh_module('tkinter')
# Skip test if tk cannot be initialized.
support.requires('gui')
@@ -14,20 +14,24 @@ support.requires('gui')
from _tkinter import TclError
from tkinter import ttk
from tkinter.test import runtktests
-from tkinter.test.support import get_tk_root
+root = None
try:
- ttk.Button()
+ root = tkinter.Tk()
+ button = ttk.Button(root)
+ button.destroy()
+ del button
except TclError as msg:
# assuming ttk is not available
raise unittest.SkipTest("ttk not available: %s" % msg)
+finally:
+ if root is not None:
+ root.destroy()
+ del root
def test_main():
- try:
- support.run_unittest(
- *runtktests.get_tests(text=False, packages=['test_ttk']))
- finally:
- get_tk_root().destroy()
+ support.run_unittest(
+ *runtktests.get_tests(text=False, packages=['test_ttk']))
if __name__ == '__main__':
test_main()