blob: 56eef47dfa83050108e7591bccdefa167c04678a [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
Zachary Ware2460dc82014-05-02 10:33:49 -05004# Skip test if _tkinter wasn't built or gui resource is not available.
R. David Murray597ebab2009-03-31 18:32:17 +00005test_support.import_module('_tkinter')
Zachary Ware2460dc82014-05-02 10:33:49 -05006test_support.requires('gui')
R. David Murray597ebab2009-03-31 18:32:17 +00007
Guilherme Polobbb7efd2009-02-09 19:21:21 +00008this_dir = os.path.dirname(os.path.abspath(__file__))
9lib_tk_test = os.path.abspath(os.path.join(this_dir, os.path.pardir,
10 'lib-tk', 'test'))
Guilherme Polobbb7efd2009-02-09 19:21:21 +000011
Nick Coghlan53a9dc92009-10-18 10:56:21 +000012with test_support.DirsOnSysPath(lib_tk_test):
13 import runtktests
Guilherme Polobbb7efd2009-02-09 19:21:21 +000014
15def 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 Coghlan53a9dc92009-10-18 10:56:21 +000022 with test_support.DirsOnSysPath(lib_tk_test):
23 test_support.run_unittest(
Guilherme Polobbb7efd2009-02-09 19:21:21 +000024 *runtktests.get_tests(text=False, packages=['test_tkinter']))
25
26if __name__ == '__main__':
27 test_main(enable_gui=True)