summaryrefslogtreecommitdiff
path: root/coverage/control.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2010-01-09 20:57:37 -0500
committerNed Batchelder <ned@nedbatchelder.com>2010-01-09 20:57:37 -0500
commit1bec288c62eca5f608e047c009730a43da7df725 (patch)
treecf4784f5aa045684f705a24c11935aadaafe5b0a /coverage/control.py
parent0d54199f9c087c230d6e7d1bc0fd933ffb5ac82a (diff)
downloadpython-coveragepy-git-1bec288c62eca5f608e047c009730a43da7df725.tar.gz
XML output file is configurable in .rc file.
--HG-- rename : test/farm/html/run_a_xml.py => test/farm/html/run_a_xml_1.py
Diffstat (limited to 'coverage/control.py')
-rw-r--r--coverage/control.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/coverage/control.py b/coverage/control.py
index 3a1b7f0f..5c253808 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -366,14 +366,21 @@ class coverage(object):
"""Generate an XML report of coverage results.
The report is compatible with Cobertura reports.
+
+ Each module in `morfs` is included in the report. `outfile` is the
+ path to write the file to, "-" will write to stdout.
"""
self.config.from_args(
ignore_errors=ignore_errors,
- omit_prefixes=omit_prefixes
+ omit_prefixes=omit_prefixes,
+ xml_output=outfile,
)
- if outfile:
- outfile = open(outfile, "w")
+ if self.config.xml_output:
+ if self.config.xml_output == '-':
+ outfile = sys.stdout
+ else:
+ outfile = open(self.config.xml_output, "w")
try:
reporter = XmlReporter(self, self.config.ignore_errors)
reporter.report(