Guilherme Polo | bbb7efd | 2009-02-09 19:21:21 +0000 | [diff] [blame] | 1 | import os |
| 2 | import sys |
Guilherme Polo | 55bdb8e | 2009-02-09 19:57:04 +0000 | [diff] [blame] | 3 | import Tkinter |
Guilherme Polo | bbb7efd | 2009-02-09 19:21:21 +0000 | [diff] [blame] | 4 | from test import test_support |
| 5 | |
Guilherme Polo | 55bdb8e | 2009-02-09 19:57:04 +0000 | [diff] [blame] | 6 | try: |
| 7 | Tkinter.Button() |
| 8 | except Tkinter.TclError, msg: |
| 9 | # assuming tk is not available |
Benjamin Peterson | 888a39b | 2009-03-26 20:48:25 +0000 | [diff] [blame] | 10 | raise unittest.SkipTest("tk not available: %s" % msg) |
Guilherme Polo | 55bdb8e | 2009-02-09 19:57:04 +0000 | [diff] [blame] | 11 | |
Guilherme Polo | bbb7efd | 2009-02-09 19:21:21 +0000 | [diff] [blame] | 12 | this_dir = os.path.dirname(os.path.abspath(__file__)) |
| 13 | lib_tk_test = os.path.abspath(os.path.join(this_dir, os.path.pardir, |
| 14 | 'lib-tk', 'test')) |
| 15 | if lib_tk_test not in sys.path: |
| 16 | sys.path.append(lib_tk_test) |
| 17 | |
| 18 | import runtktests |
| 19 | |
| 20 | def test_main(enable_gui=False): |
| 21 | if enable_gui: |
| 22 | if test_support.use_resources is None: |
| 23 | test_support.use_resources = ['gui'] |
| 24 | elif 'gui' not in test_support.use_resources: |
| 25 | test_support.use_resources.append('gui') |
| 26 | |
| 27 | test_support.run_unittest( |
| 28 | *runtktests.get_tests(text=False, packages=['test_tkinter'])) |
| 29 | |
| 30 | if __name__ == '__main__': |
| 31 | test_main(enable_gui=True) |