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 | 185efb980902b5ab726ccfd3b411140e9b3d05fa (patch) | |
tree | 8cc5bc6f81d9524393379dc7ddc060dfb078a795 /coverage/cmdline.py | |
parent | 4ff8b33cc769658c756215ac92e5d737cb209e82 (diff) | |
download | python-coveragepy-185efb980902b5ab726ccfd3b411140e9b3d05fa.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 26da9fd..accade5 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 |