test_idle.py 821 B

1234567891011121314151617181920
  1. import unittest
  2. from test import test_support as support
  3. from test.test_support import import_module
  4. # Skip test if _thread or _tkinter wasn't built or idlelib was deleted.
  5. import_module('threading') # imported by idlelib.PyShell, imports _thread
  6. tk = import_module('Tkinter') # imports _tkinter
  7. idletest = import_module('idlelib.idle_test')
  8. # Without test_main present, regrtest.runtest_inner (line1219) calls
  9. # unittest.TestLoader().loadTestsFromModule(this_module) which calls
  10. # load_tests() if it finds it. (Unittest.main does the same.)
  11. load_tests = idletest.load_tests
  12. # pre-3.3 regrtest does not support the load_tests protocol. use test_main
  13. def test_main():
  14. support.run_unittest(unittest.TestLoader().loadTestsFromModule(idletest))
  15. if __name__ == '__main__':
  16. unittest.main(verbosity=2, exit=False)