diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2009-09-25 21:47:36 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2009-09-25 21:47:36 -0400 |
commit | 17e6ca309e07186eed46242b1903a84c9bc5e167 (patch) | |
tree | 8a4df6d5f8e28429baad275cc0058f3d1654e5ba /coverage/cmdline.py | |
parent | bc6d5e8768017eb474d00af2828895f5199c05c6 (diff) | |
download | python-coveragepy-git-17e6ca309e07186eed46242b1903a84c9bc5e167.tar.gz |
XML command writes to coverage.xml, and takes a -o argument to write it somewhere else.
Diffstat (limited to 'coverage/cmdline.py')
-rw-r--r-- | coverage/cmdline.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/coverage/cmdline.py b/coverage/cmdline.py index 26da9fd4..accade5b 100644 --- a/coverage/cmdline.py +++ b/coverage/cmdline.py @@ -43,6 +43,11 @@ class Opts: help="Omit files when their filename path starts with one of these " "prefixes." ) + output_xml = optparse.Option( + '-o', '', action='store', dest="outfile", + metavar="OUTFILE", + help="Write the XML report to this file. Defaults to 'coverage.xml'" + ) parallel_mode = optparse.Option( '-p', '--parallel-mode', action='store_true', help="Include the machine name and process id in the .coverage " @@ -253,9 +258,11 @@ CMDS = { [ Opts.ignore_errors, Opts.omit, + Opts.output_xml, Opts.help, ], cmd = "xml", + defaults = {'outfile': 'coverage.xml'}, usage = "[options] [modules]", description = "Generate an XML report of coverage results." ), @@ -421,7 +428,10 @@ class CoverageScript: self.coverage.html_report( directory=options.directory, **report_args) if 'xml' in options.actions: - self.coverage.xml_report(**report_args) + outfile = options.outfile + if outfile == '-': + outfile = None + self.coverage.xml_report(outfile=outfile, **report_args) return OK |