mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Fixes #10541: regrtest -T is broken
* makes test_trace tests restore the tracefunc after they run * write_results() in trace module will not terminate if lnotab cannot be found.
This commit is contained in:
parent
15c6ed5239
commit
f026dae130
2 changed files with 15 additions and 10 deletions
19
Lib/trace.py
19
Lib/trace.py
|
@ -326,16 +326,17 @@ class CoverageResults:
|
|||
lnotab = _find_executable_linenos(filename)
|
||||
else:
|
||||
lnotab = {}
|
||||
if lnotab:
|
||||
source = linecache.getlines(filename)
|
||||
coverpath = os.path.join(dir, modulename + ".cover")
|
||||
with open(filename, 'rb') as fp:
|
||||
encoding, _ = tokenize.detect_encoding(fp.readline)
|
||||
n_hits, n_lines = self.write_results_file(coverpath, source,
|
||||
lnotab, count, encoding)
|
||||
if summary and n_lines:
|
||||
percent = int(100 * n_hits / n_lines)
|
||||
sums[modulename] = n_lines, percent, modulename, filename
|
||||
|
||||
source = linecache.getlines(filename)
|
||||
coverpath = os.path.join(dir, modulename + ".cover")
|
||||
with open(filename, 'rb') as fp:
|
||||
encoding, _ = tokenize.detect_encoding(fp.readline)
|
||||
n_hits, n_lines = self.write_results_file(coverpath, source,
|
||||
lnotab, count, encoding)
|
||||
if summary and n_lines:
|
||||
percent = int(100 * n_hits / n_lines)
|
||||
sums[modulename] = n_lines, percent, modulename, filename
|
||||
|
||||
if summary and sums:
|
||||
print("lines cov% module (path)")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue