test_idle.py 1014 B

12345678910111213141516171819202122232425262728
  1. import unittest
  2. from test.support.import_helper import import_module
  3. from test.support import check_sanitizer
  4. if check_sanitizer(address=True, memory=True):
  5. raise unittest.SkipTest("Tests involvin libX11 can SEGFAULT on ASAN/MSAN builds")
  6. # Skip test_idle if _tkinter wasn't built, if tkinter is missing,
  7. # if tcl/tk is not the 8.5+ needed for ttk widgets,
  8. # or if idlelib is missing (not installed).
  9. tk = import_module('tkinter') # Also imports _tkinter.
  10. if tk.TkVersion < 8.5:
  11. raise unittest.SkipTest("IDLE requires tk 8.5 or later.")
  12. idlelib = import_module('idlelib')
  13. # Before importing and executing more of idlelib,
  14. # tell IDLE to avoid changing the environment.
  15. idlelib.testing = True
  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. if __name__ == '__main__':
  20. tk.NoDefaultRoot()
  21. unittest.main(exit=False)
  22. tk._support_default_root = True
  23. tk._default_root = None