66 xcoverage = self.xml_out.documentElement |
66 xcoverage = self.xml_out.documentElement |
67 xcoverage.setAttribute("version", __version__) |
67 xcoverage.setAttribute("version", __version__) |
68 xcoverage.setAttribute("timestamp", str(int(time.time()*1000))) |
68 xcoverage.setAttribute("timestamp", str(int(time.time()*1000))) |
69 xcoverage.appendChild(self.xml_out.createComment( |
69 xcoverage.appendChild(self.xml_out.createComment( |
70 f" Generated by coverage.py: {__url__} " |
70 f" Generated by coverage.py: {__url__} " |
71 )) |
71 )) |
72 xcoverage.appendChild(self.xml_out.createComment(f" Based on {DTD_URL} ")) |
72 xcoverage.appendChild(self.xml_out.createComment(f" Based on {DTD_URL} ")) |
73 |
73 |
74 # Call xml_file for each file in the data. |
74 # Call xml_file for each file in the data. |
75 for fr, analysis in get_analysis_to_report(self.coverage, morfs): |
75 for fr, analysis in get_analysis_to_report(self.coverage, morfs): |
76 self.xml_file(fr, analysis, has_arcs) |
76 self.xml_file(fr, analysis, has_arcs) |
191 total, taken = branch_stats[line] |
191 total, taken = branch_stats[line] |
192 xline.setAttribute("branch", "true") |
192 xline.setAttribute("branch", "true") |
193 xline.setAttribute( |
193 xline.setAttribute( |
194 "condition-coverage", |
194 "condition-coverage", |
195 "%d%% (%d/%d)" % (100*taken//total, taken, total) |
195 "%d%% (%d/%d)" % (100*taken//total, taken, total) |
196 ) |
196 ) |
197 if line in missing_branch_arcs: |
197 if line in missing_branch_arcs: |
198 annlines = ["exit" if b < 0 else str(b) for b in missing_branch_arcs[line]] |
198 annlines = ["exit" if b < 0 else str(b) for b in missing_branch_arcs[line]] |
199 xline.setAttribute("missing-branches", ",".join(annlines)) |
199 xline.setAttribute("missing-branches", ",".join(annlines)) |
200 xlines.appendChild(xline) |
200 xlines.appendChild(xline) |
201 |
201 |