diff options
Diffstat (limited to 'coverage/summary.py')
-rw-r--r-- | coverage/summary.py | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/coverage/summary.py b/coverage/summary.py index e0e9eba7..89b31020 100644 --- a/coverage/summary.py +++ b/coverage/summary.py @@ -8,25 +8,30 @@ from coverage.results import Numbers class SummaryReporter(Reporter): """A reporter for writing the summary report.""" - + def __init__(self, coverage, show_missing=True, ignore_errors=False): super(SummaryReporter, self).__init__(coverage, ignore_errors) self.show_missing = show_missing self.branches = coverage.data.has_arcs() - def report(self, morfs, omit_prefixes=None, outfile=None): - """Writes a report summarizing coverage statistics per module.""" - - self.find_code_units(morfs, omit_prefixes) + def report(self, morfs, omit_prefixes=None, outfile=None, + include_prefixes=None + ): + """Writes a report summarizing coverage statistics per module. + + See `coverage.report()` for other arguments. + + """ + self.find_code_units(morfs, omit_prefixes, include_prefixes) # Prepare the formatting strings max_name = max([len(cu.name) for cu in self.code_units] + [5]) fmt_name = "%%- %ds " % max_name fmt_err = "%s %s: %s\n" - header = (fmt_name % "Name") + " Stmts Exec" + header = (fmt_name % "Name") + " Stmts Miss" fmt_coverage = fmt_name + "%6d %6d" if self.branches: - header += " Branch BrExec" + header += " Branch BrPart" fmt_coverage += " %6d %6d" header += " Cover" fmt_coverage += " %5d%%" @@ -45,20 +50,20 @@ class SummaryReporter(Reporter): outfile.write(rule) total = Numbers() - + for cu in self.code_units: try: analysis = self.coverage._analyze(cu) nums = analysis.numbers - args = (cu.name, nums.n_statements, nums.n_executed) + args = (cu.name, nums.n_statements, nums.n_missing) if self.branches: - args += (nums.n_branches, nums.n_executed_branches) + args += (nums.n_branches, nums.n_missing_branches) args += (nums.pc_covered,) if self.show_missing: args += (analysis.missing_formatted(),) outfile.write(fmt_coverage % args) total += nums - except KeyboardInterrupt: #pragma: no cover + except KeyboardInterrupt: # pragma: no cover raise except: if not self.ignore_errors: @@ -67,9 +72,9 @@ class SummaryReporter(Reporter): if total.n_files > 1: outfile.write(rule) - args = ("TOTAL", total.n_statements, total.n_executed) + args = ("TOTAL", total.n_statements, total.n_missing) if self.branches: - args += (total.n_branches, total.n_executed_branches) + args += (total.n_branches, total.n_missing_branches) args += (total.pc_covered,) if self.show_missing: args += ("",) |