summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-04-27 23:51:16 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-04-27 23:51:16 (GMT)
commitc73a05f775013980a2a0de1c2a65b8542ee0bfa6 (patch)
tree1736a0b441dc0f6cd20157f2436d5593eef44c54
parent47c884129d4b12cd06a5b77c5833b0afee28cd25 (diff)
downloadcpython-c73a05f775013980a2a0de1c2a65b8542ee0bfa6.zip
cpython-c73a05f775013980a2a0de1c2a65b8542ee0bfa6.tar.gz
cpython-c73a05f775013980a2a0de1c2a65b8542ee0bfa6.tar.bz2
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().
-rw-r--r--Lib/test/test_cmd.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/test/test_cmd.py b/Lib/test/test_cmd.py
index 2ee5cef..19ee52e 100644
--- a/Lib/test/test_cmd.py
+++ b/Lib/test/test_cmd.py
@@ -7,6 +7,7 @@ Original by Michael Schneider
import cmd
import sys
+from test import test_support
class samplecmdclass(cmd.Cmd):
"""
@@ -168,11 +169,11 @@ class samplecmdclass(cmd.Cmd):
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()')