summaryrefslogtreecommitdiff
path: root/coverage/xmlreport.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-12-02 07:27:14 -0500
committerNed Batchelder <ned@nedbatchelder.com>2009-12-02 07:27:14 -0500
commit968fc008e4c0453ef05aa211e85e202e7b1d2342 (patch)
tree91ae38367181a9ee0dda9ed22aa832031ca4c3d7 /coverage/xmlreport.py
parent007a4a1ba529e2913357387c1f42b6028860fe98 (diff)
downloadpython-coveragepy-git-968fc008e4c0453ef05aa211e85e202e7b1d2342.tar.gz
Massive eol whitespace clean-up.
Diffstat (limited to 'coverage/xmlreport.py')
-rw-r--r--coverage/xmlreport.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/coverage/xmlreport.py b/coverage/xmlreport.py
index 9cc6567a..ab44025d 100644
--- a/coverage/xmlreport.py
+++ b/coverage/xmlreport.py
@@ -14,20 +14,20 @@ def rate(hit, num):
class XmlReporter(Reporter):
"""A reporter for writing Cobertura-style XML coverage results."""
-
+
def __init__(self, coverage, ignore_errors=False):
super(XmlReporter, self).__init__(coverage, ignore_errors)
-
+
self.packages = None
self.xml_out = None
self.arcs = coverage.data.has_arcs()
def report(self, morfs, omit_prefixes=None, outfile=None):
"""Generate a Cobertura-compatible XML report for `morfs`.
-
+
`morfs` is a list of modules or filenames. `omit_prefixes` is a list
of strings, prefixes of modules to omit from the report.
-
+
"""
# Initial setup.
outfile = outfile or sys.stdout
@@ -39,7 +39,7 @@ class XmlReporter(Reporter):
"http://cobertura.sourceforge.net/xml/coverage-03.dtd"
)
self.xml_out = impl.createDocument(None, "coverage", docType)
-
+
# Write header stuff.
xcoverage = self.xml_out.documentElement
xcoverage.setAttribute("version", __version__)
@@ -56,7 +56,7 @@ class XmlReporter(Reporter):
lnum_tot, lhits_tot = 0, 0
bnum_tot, bhits_tot = 0, 0
-
+
# Populate the XML DOM with the package info.
for pkg_name, pkg_data in self.packages.items():
class_elts, lhits, lnum, bhits, bnum = pkg_data
@@ -75,16 +75,16 @@ class XmlReporter(Reporter):
lhits_tot += lhits
bnum_tot += bnum
bhits_tot += bhits
-
+
xcoverage.setAttribute("line-rate", str(rate(lhits_tot, lnum_tot)))
xcoverage.setAttribute("branch-rate", str(rate(bhits_tot, bnum_tot)))
-
+
# Use the DOM to write the output file.
outfile.write(self.xml_out.toprettyxml())
def xml_file(self, cu, analysis):
"""Add to the XML report for a single file."""
-
+
# Create the 'lines' and 'package' XML elements, which
# are populated later. Note that a package == a directory.
dirname, fname = os.path.split(cu.name)
@@ -133,7 +133,7 @@ class XmlReporter(Reporter):
else:
class_branches = 0.0
class_branch_hits = 0.0
-
+
# Finalize the statistics that are collected in the XML DOM.
line_rate = rate(class_hits, class_lines)
branch_rate = rate(class_branch_hits, class_branches)