1import unittest
2from test.support.import_helper import import_module
3from test.support import check_sanitizer
4
5if check_sanitizer(address=True, memory=True):
6    raise unittest.SkipTest("Tests involvin libX11 can SEGFAULT on ASAN/MSAN builds")
7
8# Skip test_idle if _tkinter, tkinter, or idlelib are missing.
9tk = import_module('tkinter')  # Also imports _tkinter.
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