]>
Commit | Line | Data |
---|---|---|
4710c53d | 1 | import os\r |
2 | import unittest\r | |
3 | from test import test_support\r | |
4 | \r | |
5 | # Skip this test if _tkinter wasn't built.\r | |
6 | test_support.import_module('_tkinter')\r | |
7 | \r | |
8 | import ttk\r | |
9 | from _tkinter import TclError\r | |
10 | \r | |
11 | try:\r | |
12 | ttk.Button()\r | |
13 | except TclError, msg:\r | |
14 | # assuming ttk is not available\r | |
15 | raise unittest.SkipTest("ttk not available: %s" % msg)\r | |
16 | \r | |
17 | this_dir = os.path.dirname(os.path.abspath(__file__))\r | |
18 | lib_tk_test = os.path.abspath(os.path.join(this_dir, os.path.pardir,\r | |
19 | 'lib-tk', 'test'))\r | |
20 | \r | |
21 | with test_support.DirsOnSysPath(lib_tk_test):\r | |
22 | import runtktests\r | |
23 | \r | |
24 | def test_main(enable_gui=False):\r | |
25 | if enable_gui:\r | |
26 | if test_support.use_resources is None:\r | |
27 | test_support.use_resources = ['gui']\r | |
28 | elif 'gui' not in test_support.use_resources:\r | |
29 | test_support.use_resources.append('gui')\r | |
30 | \r | |
31 | with test_support.DirsOnSysPath(lib_tk_test):\r | |
32 | from test_ttk.support import get_tk_root\r | |
33 | try:\r | |
34 | test_support.run_unittest(\r | |
35 | *runtktests.get_tests(text=False, packages=['test_ttk']))\r | |
36 | finally:\r | |
37 | get_tk_root().destroy()\r | |
38 | \r | |
39 | if __name__ == '__main__':\r | |
40 | test_main(enable_gui=True)\r |