1 import unittest 2 from test.support 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). 7 tk = import_module('tkinter') # Also imports _tkinter. 8 if tk.TkVersion < 8.5: 9 raise unittest.SkipTest("IDLE requires tk 8.5 or later.") 10 idlelib = import_module('idlelib') 11 12 # Before importing and executing more of idlelib, 13 # tell IDLE to avoid changing the environment. 14 idlelib.testing = True 15 16 # Unittest.main and test.libregrtest.runtest.runtest_inner 17 # call load_tests, when present here, to discover tests to run. 18 from idlelib.idle_test import load_tests 19 20 if __name__ == '__main__': 21 tk.NoDefaultRoot() 22 unittest.main(exit=False) 23 tk._support_default_root = 1 24 tk._default_root = None 25