summaryrefslogtreecommitdiff
path: root/coverage/html.py
diff options
context:
space:
mode:
authorZooko Ofsimplegeo <zooko@simplegeo.com>2010-04-19 16:08:37 -0600
committerZooko Ofsimplegeo <zooko@simplegeo.com>2010-04-19 16:08:37 -0600
commitce4dbf3b92dcccf146cdf8c0bfb2f6da0a7c5dd5 (patch)
treec1841e353e5968604551161e2afbd4ebad38fe75 /coverage/html.py
parent6638c632a10af6477a712f1a86af6d9e9ab3a3e3 (diff)
downloadpython-coveragepy-git-ce4dbf3b92dcccf146cdf8c0bfb2f6da0a7c5dd5.tar.gz
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
Diffstat (limited to 'coverage/html.py')
-rw-r--r--coverage/html.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/coverage/html.py b/coverage/html.py
index 7d0d064b..61712f36 100644
--- a/coverage/html.py
+++ b/coverage/html.py
@@ -31,18 +31,23 @@ class HtmlReporter(Reporter):
self.files = []
self.arcs = coverage.data.has_arcs()
- def report(self, morfs, directory, omit_prefixes=None):
+ def report(self, morfs, directory, omit_prefixes=None, require_prefixes=None):
"""Generate an HTML report for `morfs`.
`morfs` is a list of modules or filenames. `directory` is where to put
the HTML files. `omit_prefixes` is a list of strings, prefixes of
modules to omit from the report.
+ `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`.
"""
assert directory, "must provide a directory for html reporting"
# Process all the files.
- self.report_files(self.html_file, morfs, directory, omit_prefixes)
+ self.report_files(self.html_file, morfs, directory, omit_prefixes, require_prefixes)
# Write the index file.
self.index_file()