1import unittest 2from test import test_support as support 3from test.test_support import import_module 4 5# Skip test if _thread or _tkinter wasn't built or idlelib was deleted. 6import_module('threading') # imported by idlelib.PyShell, imports _thread 7tk = import_module('Tkinter') # imports _tkinter 8idletest = import_module('idlelib.idle_test') 9 10# Without test_main present, regrtest.runtest_inner (line1219) calls 11# unittest.TestLoader().loadTestsFromModule(this_module) which calls 12# load_tests() if it finds it. (Unittest.main does the same.) 13load_tests = idletest.load_tests 14 15# pre-3.3 regrtest does not support the load_tests protocol. use test_main 16def test_main(): 17 support.run_unittest(unittest.TestLoader().loadTestsFromModule(idletest)) 18 19if __name__ == '__main__': 20 unittest.main(verbosity=2, exit=False) 21