diff -r bedab77d0fa3 -r d6c795b5ce33 DebugClients/Python/coverage/xmlreport.py --- a/DebugClients/Python/coverage/xmlreport.py Sat Apr 07 13:17:06 2018 +0200 +++ b/DebugClients/Python/coverage/xmlreport.py Sat Apr 07 13:35:10 2018 +0200 @@ -18,11 +18,7 @@ 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 @@ 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() @@ -148,7 +150,7 @@ else: rel_name = fr.relative_filename() - dirname = os.path.dirname(rel_name) or "." + dirname = os.path.dirname(rel_name) or u"." dirname = "/".join(dirname.split("/")[:self.config.xml_package_depth]) package_name = dirname.replace("/", ".") @@ -164,7 +166,7 @@ xclass.appendChild(xlines) xclass.setAttribute("name", os.path.relpath(rel_name, dirname)) - xclass.setAttribute("filename", fr.relative_filename().replace("\\", "/")) + xclass.setAttribute("filename", rel_name.replace("\\", "/")) xclass.setAttribute("complexity", "0") branch_stats = analysis.branch_stats() @@ -185,7 +187,7 @@ xline.setAttribute("branch", "true") xline.setAttribute( "condition-coverage", - "%d%% (%d/%d)" % (100*taken/total, taken, total) + "%d%% (%d/%d)" % (100*taken//total, taken, total) ) if line in missing_branch_arcs: annlines = ["exit" if b < 0 else str(b) for b in missing_branch_arcs[line]]