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
commit46b0b4bc9fcbe56cb5d8782703f327366455bd93 (patch)
tree0a60f1ff1b2b42ce7cf1becd74c6f37ef37161ea /coverage/control.py
parent488205aed767918e92d378d9483f7b471bf7aefd (diff)
downloadpython-coveragepy-46b0b4bc9fcbe56cb5d8782703f327366455bd93.tar.gz
XML output file is configurable in .rc file.
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 3a1b7f0..5c25380 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(