From ce4dbf3b92dcccf146cdf8c0bfb2f6da0a7c5dd5 Mon Sep 17 00:00:00 2001 From: Zooko Ofsimplegeo Date: Mon, 19 Apr 2010 16:08:37 -0600 Subject: add a --require option to specify directories which are required to be at the beginning of the path for any file that is going to be included in code coverage make the --omit and --require options apply to code coverage generation as well as to reporting; This speeds up tests from 6 seconds to 1 second on my system, as well as making the resulting .coverage db include *only* the code that I care about, which helps with my code coverage progression/regression tool. --HG-- extra : transplant_source : %1F.4%81%E8%DA%0B%D0%D5%9D%89%DE%E1vY%E6%CD%1A%EB%C9 --- coverage/summary.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'coverage/summary.py') diff --git a/coverage/summary.py b/coverage/summary.py index 7348acab..696f6b36 100644 --- a/coverage/summary.py +++ b/coverage/summary.py @@ -14,10 +14,16 @@ class SummaryReporter(Reporter): 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.""" + def report(self, morfs, omit_prefixes=None, outfile=None, require_prefixes=None): + """Writes a report summarizing coverage statistics per module. - self.find_code_units(morfs, omit_prefixes) + `omit_prefixes` is a list of prefixes. CodeUnits that match those prefixes + will be omitted from the list. + `require_prefixes` is a list of prefixes. Only CodeUnits that match those prefixes + will be included in the list. + You are required to pass at most one of `omit_prefixes` and `require_prefixes`. + """ + self.find_code_units(morfs, omit_prefixes, require_prefixes) # Prepare the formatting strings max_name = max([len(cu.name) for cu in self.code_units] + [5]) -- cgit v1.2.1