[Python-checkins] r80570 - python/trunk/Lib/test/test_cmd.py

victor.stinner python-checkins at python.org
Wed Apr 28 01:51:17 CEST 2010


Author: victor.stinner
Date: Wed Apr 28 01:51:16 2010
New Revision: 80570

Log:
Issue #7449, part 10: test_cmd imports trace module using test_support.import_module()

Use test_support.import_module() instead of import to raise a SkipTest
exception if the import fail. Import trace fails if the threading module is
missing.

See also part 3: test_doctest: import trace module in test_coverage().


Modified:
   python/trunk/Lib/test/test_cmd.py

Modified: python/trunk/Lib/test/test_cmd.py
==============================================================================
--- python/trunk/Lib/test/test_cmd.py	(original)
+++ python/trunk/Lib/test/test_cmd.py	Wed Apr 28 01:51:16 2010
@@ -7,6 +7,7 @@
 
 import cmd
 import sys
+from test import test_support
 
 class samplecmdclass(cmd.Cmd):
     """
@@ -168,11 +169,11 @@
         return True
 
 def test_main(verbose=None):
-    from test import test_support, test_cmd
+    from test import test_cmd
     test_support.run_doctest(test_cmd, verbose)
 
 def test_coverage(coverdir):
-    import trace
+    trace = test_support.import_module('trace')
     tracer=trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix,],
                         trace=0, count=1)
     tracer.run('reload(cmd);test_main()')


More information about the Python-checkins mailing list