source: python/trunk/Lib/test/test_idle.py

Last change on this file was 391, checked in by dmik, 11 years ago

python: Merge vendor 2.7.6 to trunk.

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1import unittest
2from test import test_support as support
3from test.test_support import import_module, use_resources
4
5# Skip test if _thread or _tkinter wasn't built or idlelib was deleted.
6import_module('threading') # imported by idlelib.PyShell, imports _thread
7tk = import_module('Tkinter') # imports _tkinter
8idletest = import_module('idlelib.idle_test')
9
10# If buildbot improperly sets gui resource (#18365, #18441), remove it
11# so requires('gui') tests are skipped while non-gui tests still run.
12# If there is a problem with Macs, see #18441, msg 193805
13if use_resources and 'gui' in use_resources:
14 try:
15 root = tk.Tk()
16 root.destroy()
17 except tk.TclError:
18 while 'gui' in use_resources:
19 use_resources.remove('gui')
20
21# Without test_main present, regrtest.runtest_inner (line1219) calls
22# unittest.TestLoader().loadTestsFromModule(this_module) which calls
23# load_tests() if it finds it. (Unittest.main does the same.)
24load_tests = idletest.load_tests
25
26if __name__ == '__main__':
27 # Until unittest supports resources, we emulate regrtest's -ugui
28 # so loaded tests run the same as if textually present here.
29 # If any Idle test ever needs another resource, add it to the list.
30 support.use_resources = ['gui'] # use_resources is initially None
31 unittest.main(verbosity=2, exit=False)
Note: See TracBrowser for help on using the repository browser.