From 9266eebcd681ec38f118fe018a154acb5f1c67ae Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 22 Jul 2015 08:44:58 -0400 Subject: Add an attribute to the XML report for missed branches --- coverage/xmlreport.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'coverage/xmlreport.py') diff --git a/coverage/xmlreport.py b/coverage/xmlreport.py index 5f16bc4f..0df449f3 100644 --- a/coverage/xmlreport.py +++ b/coverage/xmlreport.py @@ -147,6 +147,7 @@ class XmlReporter(Reporter): xclass.setAttribute("complexity", "0") branch_stats = analysis.branch_stats() + missing_branch_arcs = analysis.missing_branch_arcs() # For each statement, create an XML 'line' element. for line in sorted(analysis.statements): @@ -165,6 +166,9 @@ class XmlReporter(Reporter): "condition-coverage", "%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]] + xline.setAttribute("missing-branches", ",".join(annlines)) xlines.appendChild(xline) class_lines = len(analysis.statements) -- cgit v1.2.1