From c73a05f775013980a2a0de1c2a65b8542ee0bfa6 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 27 Apr 2010 23:51:16 +0000 Subject: 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(). --- Lib/test/test_cmd.py | 5 +++-- 1 file 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()') -- cgit v0.12