|
1 | | -#!/usr/bin/env python3 |
2 | | - |
3 | 1 | # portions copyright 2001, Autonomous Zones Industries, Inc., all rights... |
4 | 2 | # err... reserved and offered to the public under the terms of the |
5 | 3 | # Python 2.2 license. |
@@ -281,14 +279,13 @@ def write_results(self, show_missing=True, summary=False, coverdir=None, *, |
281 | 279 | n_hits, n_lines = self.write_results_file(coverpath, source, |
282 | 280 | lnotab, count, encoding) |
283 | 281 | if summary and n_lines: |
284 | | - percent = int(100 * n_hits / n_lines) |
285 | | - sums[modulename] = n_lines, percent, modulename, filename |
| 282 | + sums[modulename] = n_lines, n_hits, modulename, filename |
286 | 283 |
|
287 | 284 | if summary and sums: |
288 | 285 | print("lines cov% module (path)") |
289 | 286 | for m in sorted(sums): |
290 | | - n_lines, percent, modulename, filename = sums[m] |
291 | | - print("%5d %3d%% %s (%s)" % sums[m]) |
| 287 | + n_lines, n_hits, modulename, filename = sums[m] |
| 288 | + print(f"{n_lines:5d} {n_hits/n_lines:.1%} {modulename} ({filename})") |
292 | 289 |
|
293 | 290 | if self.outfile: |
294 | 291 | # try and store counts and module info into self.outfile |
@@ -402,7 +399,7 @@ def __init__(self, count=1, trace=1, countfuncs=0, countcallers=0, |
402 | 399 | @param countfuncs true iff it should just output a list of |
403 | 400 | (filename, modulename, funcname,) for functions |
404 | 401 | that were called at least once; This overrides |
405 | | - `count' and `trace' |
| 402 | + 'count' and 'trace' |
406 | 403 | @param ignoremods a list of the names of modules to ignore |
407 | 404 | @param ignoredirs a list of the names of directories to ignore |
408 | 405 | all of the (recursive) contents of |
@@ -534,7 +531,7 @@ def globaltrace_countfuncs(self, frame, why, arg): |
534 | 531 | def globaltrace_lt(self, frame, why, arg): |
535 | 532 | """Handler for call events. |
536 | 533 |
|
537 | | - If the code block being entered is to be ignored, returns `None', |
| 534 | + If the code block being entered is to be ignored, returns 'None', |
538 | 535 | else returns self.localtrace. |
539 | 536 | """ |
540 | 537 | if why == 'call': |
@@ -607,7 +604,7 @@ def results(self): |
607 | 604 | def main(): |
608 | 605 | import argparse |
609 | 606 |
|
610 | | - parser = argparse.ArgumentParser() |
| 607 | + parser = argparse.ArgumentParser(color=True) |
611 | 608 | parser.add_argument('--version', action='version', version='trace 2.0') |
612 | 609 |
|
613 | 610 | grp = parser.add_argument_group('Main options', |
|
0 commit comments