summaryrefslogtreecommitdiff
path: root/coverage/xmlreport.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-07-22 08:44:58 -0400
committerNed Batchelder <ned@nedbatchelder.com>2015-07-22 08:44:58 -0400
commit3d46673ad7461d5b90b12b3de62d84611e293fa9 (patch)
tree2e06dd0d7656eb01aef3482e07aeae318f4929a4 /coverage/xmlreport.py
parent9864122a95d23254cbecb341e6993304cdaaec28 (diff)
downloadpython-coveragepy-3d46673ad7461d5b90b12b3de62d84611e293fa9.tar.gz
Add an attribute to the XML report for missed branches
Diffstat (limited to 'coverage/xmlreport.py')
-rw-r--r--coverage/xmlreport.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/coverage/xmlreport.py b/coverage/xmlreport.py
index 5f16bc4..0df449f 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)