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 | |
Zachary Ware | 2460dc8 | 2014-05-02 10:33:49 -0500 | [diff] [blame] | 4 | # Skip test if _tkinter wasn't built or gui resource is not available. |
R. David Murray | 597ebab | 2009-03-31 18:32:17 +0000 | [diff] [blame] | 5 | test_support.import_module('_tkinter') |
Zachary Ware | 2460dc8 | 2014-05-02 10:33:49 -0500 | [diff] [blame] | 6 | test_support.requires('gui') |
R. David Murray | 597ebab | 2009-03-31 18:32:17 +0000 | [diff] [blame] | 7 | |
Guilherme Polo | bbb7efd | 2009-02-09 19:21:21 +0000 | [diff] [blame] | 8 | this_dir = os.path.dirname(os.path.abspath(__file__)) |
| 9 | lib_tk_test = os.path.abspath(os.path.join(this_dir, os.path.pardir, |
| 10 | 'lib-tk', 'test')) |
Guilherme Polo | bbb7efd | 2009-02-09 19:21:21 +0000 | [diff] [blame] | 11 | |
Nick Coghlan | 53a9dc9 | 2009-10-18 10:56:21 +0000 | [diff] [blame] | 12 | with test_support.DirsOnSysPath(lib_tk_test): |
| 13 | import runtktests |
Guilherme Polo | bbb7efd | 2009-02-09 19:21:21 +0000 | [diff] [blame] | 14 | |
| 15 | def test_main(enable_gui=False): |
| 16 | if enable_gui: |
| 17 | if test_support.use_resources is None: |
| 18 | test_support.use_resources = ['gui'] |
| 19 | elif 'gui' not in test_support.use_resources: |
| 20 | test_support.use_resources.append('gui') |
| 21 | |
Nick Coghlan | 53a9dc9 | 2009-10-18 10:56:21 +0000 | [diff] [blame] | 22 | with test_support.DirsOnSysPath(lib_tk_test): |
| 23 | test_support.run_unittest( |
Guilherme Polo | bbb7efd | 2009-02-09 19:21:21 +0000 | [diff] [blame] | 24 | *runtktests.get_tests(text=False, packages=['test_tkinter'])) |
| 25 | |
| 26 | if __name__ == '__main__': |
| 27 | test_main(enable_gui=True) |