diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2017-04-04 13:02:30 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2017-04-04 13:02:30 -0400 |
commit | d38c12aae6ce8b1954c06c699f3257053ba424ca (patch) | |
tree | 06a31d92d8f36761aaf5be2274e09bb3d5a6d867 /coverage/xmlreport.py | |
parent | e9ef845fd2f3c849485dacfe1f8070cbffe957b5 (diff) | |
download | python-coveragepy-git-d38c12aae6ce8b1954c06c699f3257053ba424ca.tar.gz |
Use Cobertura v4 XML format. #570
Diffstat (limited to 'coverage/xmlreport.py')
-rw-r--r-- | coverage/xmlreport.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/coverage/xmlreport.py b/coverage/xmlreport.py index 694415fd..8af0d785 100644 --- a/coverage/xmlreport.py +++ b/coverage/xmlreport.py @@ -18,11 +18,7 @@ from coverage.report import Reporter os = isolate_module(os) -DTD_URL = ( - 'https://raw.githubusercontent.com/cobertura/web/' - 'f0366e5e2cf18f111cbd61fc34ef720a6584ba02' - '/htdocs/xml/coverage-03.dtd' -) +DTD_URL = 'https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd' def rate(hit, num): @@ -114,12 +110,18 @@ class XmlReporter(Reporter): bnum_tot += bnum bhits_tot += bhits + xcoverage.setAttribute("lines-valid", str(lnum_tot)) + xcoverage.setAttribute("lines-covered", str(lhits_tot)) xcoverage.setAttribute("line-rate", rate(lhits_tot, lnum_tot)) if self.has_arcs: - branch_rate = rate(bhits_tot, bnum_tot) + xcoverage.setAttribute("branches-valid", str(bnum_tot)) + xcoverage.setAttribute("branches-covered", str(bhits_tot)) + xcoverage.setAttribute("branch-rate", rate(bhits_tot, bnum_tot)) else: - branch_rate = "0" - xcoverage.setAttribute("branch-rate", branch_rate) + xcoverage.setAttribute("branches-covered", "0") + xcoverage.setAttribute("branches-valid", "0") + xcoverage.setAttribute("branch-rate", "0") + xcoverage.setAttribute("complexity", "0") # Use the DOM to write the output file. out = self.xml_out.toprettyxml() |