summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ttk_guionly.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2021-10-13 16:12:48 (GMT)
committerGitHub <noreply@github.com>2021-10-13 16:12:48 (GMT)
commitf59ed3c310a7ceebf2a56a84ea969a7f75d95b64 (patch)
tree4756eaa88c988fe35f1742d1907e819095d8b5b0 /Lib/test/test_ttk_guionly.py
parent676201a59f90caace606d11d4172aa74c1cd4992 (diff)
downloadcpython-f59ed3c310a7ceebf2a56a84ea969a7f75d95b64.zip
cpython-f59ed3c310a7ceebf2a56a84ea969a7f75d95b64.tar.gz
cpython-f59ed3c310a7ceebf2a56a84ea969a7f75d95b64.tar.bz2
bpo-45229: Make tkinter tests discoverable (GH-28637)
Diffstat (limited to 'Lib/test/test_ttk_guionly.py')
-rw-r--r--Lib/test/test_ttk_guionly.py41
1 files changed, 21 insertions, 20 deletions
diff --git a/Lib/test/test_ttk_guionly.py b/Lib/test/test_ttk_guionly.py
index abb2643..8f59839 100644
--- a/Lib/test/test_ttk_guionly.py
+++ b/Lib/test/test_ttk_guionly.py
@@ -11,25 +11,26 @@ support.requires('gui')
import tkinter
from _tkinter import TclError
from tkinter import ttk
-from tkinter.test import runtktests
-
-root = None
-try:
- 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():
- support.run_unittest(
- *runtktests.get_tests(text=False, packages=['test_ttk']))
+
+
+def setUpModule():
+ root = None
+ try:
+ 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 load_tests(loader, tests, pattern):
+ return loader.discover('tkinter.test.test_ttk')
+
if __name__ == '__main__':
- test_main()
+ unittest.main()