1 import unittest 2 from test import test_support as support 3 from test.test_support import import_module 4 5 # Skip test if _thread or _tkinter wasn't built or idlelib was deleted. 6 import_module('threading') # imported by idlelib.PyShell, imports _thread 7 tk = import_module('Tkinter') # imports _tkinter 8 idletest = 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.) 13 load_tests = idletest.load_tests 14 15 # pre-3.3 regrtest does not support the load_tests protocol. use test_main 16 def test_main(): 17 support.run_unittest(unittest.TestLoader().loadTestsFromModule(idletest)) 18 19 if __name__ == '__main__': 20 unittest.main(verbosity=2, exit=False) 21