1import unittest 2from test.support.import_helper import import_module 3 4# Skip test_idle if _tkinter wasn't built, if tkinter is missing, 5# if tcl/tk is not the 8.5+ needed for ttk widgets, 6# or if idlelib is missing (not installed). 7tk = import_module('tkinter') # Also imports _tkinter. 8if tk.TkVersion < 8.5: 9 raise unittest.SkipTest("IDLE requires tk 8.5 or later.") 10idlelib = import_module('idlelib') 11 12# Before importing and executing more of idlelib, 13# tell IDLE to avoid changing the environment. 14idlelib.testing = True 15 16# Unittest.main and test.libregrtest.runtest.runtest_inner 17# call load_tests, when present here, to discover tests to run. 18from idlelib.idle_test import load_tests 19 20if __name__ == '__main__': 21 tk.NoDefaultRoot() 22 unittest.main(exit=False) 23 tk._support_default_root = True 24 tk._default_root = None 25