Closed
Description
Bug report
Lines 251 to 262 in 2655369
Output:
» ./python.exe Lib/test/test_cmd.py -c
Traceback (most recent call last):
File "/Users/sobolev/Desktop/cpython2/Lib/test/test_cmd.py", line 262, in <module>
test_coverage('/tmp/cmd.cover')
File "/Users/sobolev/Desktop/cpython2/Lib/test/test_cmd.py", line 252, in test_coverage
trace = support.import_module('trace')
^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'test.support' has no attribute 'import_module'
Even, if refactored to:
def test_coverage(coverdir):
from test.support import import_helper
trace = import_helper.import_module('trace')
tracer=trace.Trace(ignoredirs=[sys.base_prefix, sys.base_exec_prefix,],
trace=0, count=1)
tracer.run('import unittest; unittest.main()')
r=tracer.results()
print("Writing coverage results...")
r.write_results(show_missing=True, summary=True, coverdir=coverdir)
It still does not work, no file is generated.
I propose to remove it, since -T
works just fine:
» ./python.exe -m test -T test_cmd
Using random seed: 2974785131
0:00:00 load avg: 1.22 Run 1 test sequentially
0:00:00 load avg: 1.22 [1/1] test_cmd
== Tests result: SUCCESS ==
1 test OK.
Total duration: 78 ms
Total tests: run=3
Total test files: run=1/1
Result: SUCCESS
lines cov% module (path)
...
236 63% cmd (/Users/sobolev/Desktop/cpython2/Lib/cmd.py)
...
I have a PR ready.
related #111348