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
commit9266eebcd681ec38f118fe018a154acb5f1c67ae (patch)
treebf8c037b55e8001aa90d888676a6602aba10c03e /coverage/xmlreport.py
parent39f5c4cb7692a0884ea9c14e6dd677c98230096f (diff)
downloadpython-coveragepy-git-9266eebcd681ec38f118fe018a154acb5f1c67ae.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 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)