aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/trace.py
diff options
context:
space:
mode:
authorRUANG (James Roy) <longjinyii@outlook.com>2024-12-04 06:33:13 +0800
committerGitHub <noreply@github.com>2024-12-03 23:33:13 +0100
commit12397a5781664bf43da98454db07cdfdec3ab815 (patch)
treec9b6b1c279e4f71a73e2807f71f403ed59008850 /Lib/trace.py
parentdabcecfd6dadb9430733105ba36925b290343d31 (diff)
downloadcpython-12397a5781664bf43da98454db07cdfdec3ab815.tar.gz
cpython-12397a5781664bf43da98454db07cdfdec3ab815.zip
gh-112192: Increase the trace module coverage precision to one decimal (#126972)
Diffstat (limited to 'Lib/trace.py')
-rw-r--r--Lib/trace.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/trace.py b/Lib/trace.py
index bb3d34fd8d6..a87bc6d61a8 100644
--- a/Lib/trace.py
+++ b/Lib/trace.py
@@ -279,14 +279,13 @@ class CoverageResults:
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
+ sums[modulename] = n_lines, n_hits, modulename, filename
if summary and sums:
print("lines cov% module (path)")
for m in sorted(sums):
- n_lines, percent, modulename, filename = sums[m]
- print("%5d %3d%% %s (%s)" % sums[m])
+ n_lines, n_hits, modulename, filename = sums[m]
+ print(f"{n_lines:5d} {n_hits/n_lines:.1%} {modulename} ({filename})")
if self.outfile:
# try and store counts and module info into self.outfile