blob: 8625db27c47c19112faaab7429c3e2430341a591 [file] [log] [blame]
Guilherme Polobbb7efd2009-02-09 19:21:21 +00001import os
Guilherme Polobbb7efd2009-02-09 19:21:21 +00002from test import test_support
3
R. David Murray597ebab2009-03-31 18:32:17 +00004# Skip test if _tkinter wasn't built.
5test_support.import_module('_tkinter')
6
Guilherme Polobbb7efd2009-02-09 19:21:21 +00007this_dir = os.path.dirname(os.path.abspath(__file__))
8lib_tk_test = os.path.abspath(os.path.join(this_dir, os.path.pardir,
9 'lib-tk', 'test'))
Guilherme Polobbb7efd2009-02-09 19:21:21 +000010
Nick Coghlan53a9dc92009-10-18 10:56:21 +000011with test_support.DirsOnSysPath(lib_tk_test):
12 import runtktests
Guilherme Polobbb7efd2009-02-09 19:21:21 +000013
Ned Deily46268c42011-07-03 21:52:35 -070014# Skip test if tk cannot be initialized.
15runtktests.check_tk_availability()
16
Guilherme Polobbb7efd2009-02-09 19:21:21 +000017def 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 Coghlan53a9dc92009-10-18 10:56:21 +000024 with test_support.DirsOnSysPath(lib_tk_test):
25 test_support.run_unittest(
Guilherme Polobbb7efd2009-02-09 19:21:21 +000026 *runtktests.get_tests(text=False, packages=['test_tkinter']))
27
28if __name__ == '__main__':
29 test_main(enable_gui=True)