Permalink
Browse files

Adds --cover-xml/--cover-xml-file options. Issue 311

  • Loading branch information...
kumar303 committed Oct 10, 2011
1 parent 0d9a2e0 commit 868ce889f1b6cf6423fdd56fbc90058c2f4895d8
Showing with 48 additions and 3 deletions.
  1. +2 −0 CHANGELOG
  2. +14 −2 README.txt
  3. +16 −0 nose/plugins/cover.py
  4. +16 −1 nosetests.1
@@ -1,5 +1,7 @@
1.1.3
- Adds :option:`--cover-xml` and :option:`--cover-xml-file` (#311).
Patch by Timothée Peignier.
- Adds support for :option:`--cover-branches` (related to #370).
Patch by Timothée Peignier.
- Fixed Unicode issue on Python 3.1 with coverage (#442)
@@ -107,7 +107,7 @@ In addition to passing command-line options, you may also put
configuration options in your project's *setup.cfg* file, or a .noserc
or nose.cfg file in your home directory. In any of these standard
.ini-style config files, you put your nosetests configuration in a
``[nosetests]`` section. Options are the same as on the command line,
"[nosetests]" section. Options are the same as on the command line,
with the -- prefix removed. For options that are simple switches, you
must supply a value:
@@ -117,7 +117,7 @@ must supply a value:
All configuration files that are found will be loaded and their
options combined. You can override the standard config file loading
with the ``-c`` option.
with the "-c" option.
Using Plugins
@@ -353,6 +353,18 @@ Options
Produce HTML coverage information in dir
--cover-branches
Include branch coverage in coverage report [NOSE_COVER_BRANCHES]
--cover-xml
Produce XML coverage information
--cover-xml-file=FILE
Produce XML coverage information in file
--pdb
Drop into debugger on errors
@@ -113,6 +113,15 @@ def options(self, parser, env):
dest="cover_branches",
help="Include branch coverage in coverage report "
"[NOSE_COVER_BRANCHES]")
parser.add_option("--cover-xml", action="store_true",
default=env.get('NOSE_COVER_XML'),
dest="cover_xml",
help="Produce XML coverage information")
parser.add_option("--cover-xml-file", action="store",
default=env.get('NOSE_COVER_XML_FILE', 'coverage.xml'),
dest="cover_xml_file",
metavar="FILE",
help="Produce XML coverage information in file")
def configure(self, options, config):
"""
@@ -149,6 +158,10 @@ def configure(self, options, config):
self.coverHtmlDir = options.cover_html_dir
log.debug('Will put HTML coverage report in %s', self.coverHtmlDir)
self.coverBranches = options.cover_branches
self.coverXmlFile = None
if options.cover_xml:
self.coverXmlFile = options.cover_xml_file
log.debug('Will put XML coverage report in %s', self.coverHtmlFile)
if self.enabled:
self.status['active'] = True
@@ -182,6 +195,9 @@ def report(self, stream):
self.coverInstance.html_report(modules, self.coverHtmlDir)
else:
self.report_html(modules)
if self.coverXmlFile:
log.debug("Generating XML coverage report")
self.coverInstance.xml_report(modules, self.coverXmlFile)
def report_html(self, modules):
if not os.path.exists(self.coverHtmlDir):
@@ -328,6 +328,21 @@ Produce HTML coverage information
Produce HTML coverage information in dir
.TP
\fB\-\-cover\-branches\fR\fR
Include branch coverage in coverage report [NOSE_COVER_BRANCHES]
.TP
\fB\-\-cover\-xml\fR\fR
Produce XML coverage information
.TP
\fB\-\-cover\-xml\-file\fR\fR=FILE
Produce XML coverage information in file
.TP
\fB\-\-pdb\fR\fR
Drop into debugger on errors
@@ -476,5 +491,5 @@ jpellerin+nose@gmail.com
.SH COPYRIGHT
LGPL
.\" Generated by docutils manpage writer on 2011-08-05 10:25.
.\" Generated by docutils manpage writer on 2011-10-10 09:32.
.\"

0 comments on commit 868ce88

Please sign in to comment.