blob: dedda0df88d3f46cf061b75041319eb9a40f8ea7 [file] [log] [blame]
Guilherme Polobbb7efd2009-02-09 19:21:21 +00001import os
2import sys
Guilherme Polo55bdb8e2009-02-09 19:57:04 +00003import Tkinter
Guilherme Polobbb7efd2009-02-09 19:21:21 +00004from test import test_support
5
Guilherme Polo55bdb8e2009-02-09 19:57:04 +00006try:
7 Tkinter.Button()
8except Tkinter.TclError, msg:
9 # assuming tk is not available
Benjamin Peterson888a39b2009-03-26 20:48:25 +000010 raise unittest.SkipTest("tk not available: %s" % msg)
Guilherme Polo55bdb8e2009-02-09 19:57:04 +000011
Guilherme Polobbb7efd2009-02-09 19:21:21 +000012this_dir = os.path.dirname(os.path.abspath(__file__))
13lib_tk_test = os.path.abspath(os.path.join(this_dir, os.path.pardir,
14 'lib-tk', 'test'))
15if lib_tk_test not in sys.path:
16 sys.path.append(lib_tk_test)
17
18import runtktests
19
20def 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
30if __name__ == '__main__':
31 test_main(enable_gui=True)