Guilherme Polo | bbb7efd | 2009-02-09 19:21:21 +0000 | [diff] [blame] | 1 | import os |
Guilherme Polo | bbb7efd | 2009-02-09 19:21:21 +0000 | [diff] [blame] | 2 | from test import test_support |
| 3 | |
R. David Murray | 597ebab | 2009-03-31 18:32:17 +0000 | [diff] [blame] | 4 | # Skip test if _tkinter wasn't built. |
| 5 | test_support.import_module('_tkinter') |
| 6 | |
Guilherme Polo | bbb7efd | 2009-02-09 19:21:21 +0000 | [diff] [blame] | 7 | this_dir = os.path.dirname(os.path.abspath(__file__)) |
| 8 | lib_tk_test = os.path.abspath(os.path.join(this_dir, os.path.pardir, |
| 9 | 'lib-tk', 'test')) |
Guilherme Polo | bbb7efd | 2009-02-09 19:21:21 +0000 | [diff] [blame] | 10 | |
Nick Coghlan | 53a9dc9 | 2009-10-18 10:56:21 +0000 | [diff] [blame] | 11 | with test_support.DirsOnSysPath(lib_tk_test): |
| 12 | import runtktests |
Guilherme Polo | bbb7efd | 2009-02-09 19:21:21 +0000 | [diff] [blame] | 13 | |
Ned Deily | 46268c4 | 2011-07-03 21:52:35 -0700 | [diff] [blame] | 14 | # Skip test if tk cannot be initialized. |
| 15 | runtktests.check_tk_availability() |
| 16 | |
Guilherme Polo | bbb7efd | 2009-02-09 19:21:21 +0000 | [diff] [blame] | 17 | def test_main(enable_gui=False): |
| 18 | if enable_gui: |
| 19 | if test_support.use_resources is None: |
| 20 | test_support.use_resources = ['gui'] |
| 21 | elif 'gui' not in test_support.use_resources: |
| 22 | test_support.use_resources.append('gui') |
| 23 | |
Nick Coghlan | 53a9dc9 | 2009-10-18 10:56:21 +0000 | [diff] [blame] | 24 | with test_support.DirsOnSysPath(lib_tk_test): |
| 25 | test_support.run_unittest( |
Guilherme Polo | bbb7efd | 2009-02-09 19:21:21 +0000 | [diff] [blame] | 26 | *runtktests.get_tests(text=False, packages=['test_tkinter'])) |
| 27 | |
| 28 | if __name__ == '__main__': |
| 29 | test_main(enable_gui=True) |