Commit c73a05f7 authored by Victor Stinner's avatar Victor Stinner

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().
parent 47c88412
......@@ -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()')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment