summaryrefslogtreecommitdiff
path: root/coverage/xmlreport.py
diff options
context:
space:
mode:
authorwonwinmcbrootles@Wonwin-McBrootles-Computer.local <wonwinmcbrootles@Wonwin-McBrootles-Computer.local>2010-05-09 22:25:41 -0600
committerwonwinmcbrootles@Wonwin-McBrootles-Computer.local <wonwinmcbrootles@Wonwin-McBrootles-Computer.local>2010-05-09 22:25:41 -0600
commitc2b6a46547f05dd7b89c1a8484c10cd02c34e542 (patch)
tree2fa5ace7cb4dcfb3303fc574158ceee0aa4873bc /coverage/xmlreport.py
parentce4dbf3b92dcccf146cdf8c0bfb2f6da0a7c5dd5 (diff)
downloadpython-coveragepy-git-c2b6a46547f05dd7b89c1a8484c10cd02c34e542.tar.gz
fix a couple of bugs in control.py such that handling of omit_prefixes and/or require_prefixes was wrong
update cmdline tests so they don't go red due to an unexpected constructor argument 'require_prefixes' note that there is not a real test of the "--require" cmdline argument -- I just added "require_prefixes=None" to the tests, so there is not test which tests what happens when someone passes --require= to the summary commands, much less to the run command. --HG-- extra : transplant_source : %F7%B3%26E%27Va%A2W4%9EX%9F%02oV%3C%A2%27%E1
Diffstat (limited to 'coverage/xmlreport.py')
-rw-r--r--coverage/xmlreport.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/coverage/xmlreport.py b/coverage/xmlreport.py
index ab44025d..4f91b1b6 100644
--- a/coverage/xmlreport.py
+++ b/coverage/xmlreport.py
@@ -22,12 +22,17 @@ class XmlReporter(Reporter):
self.xml_out = None
self.arcs = coverage.data.has_arcs()
- def report(self, morfs, omit_prefixes=None, outfile=None):
+ def report(self, morfs, omit_prefixes=None, require_prefixes=None, outfile=None):
"""Generate a Cobertura-compatible XML report for `morfs`.
`morfs` is a list of modules or filenames. `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`.
"""
# Initial setup.
outfile = outfile or sys.stdout
@@ -52,7 +57,7 @@ class XmlReporter(Reporter):
# Call xml_file for each file in the data.
self.packages = {}
- self.report_files(self.xml_file, morfs, omit_prefixes=omit_prefixes)
+ self.report_files(self.xml_file, morfs, omit_prefixes=omit_prefixes, require_prefixes=require_prefixes)
lnum_tot, lhits_tot = 0, 0
bnum_tot, bhits_tot = 0, 0