summaryrefslogtreecommitdiff
path: root/coverage/parser.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-11-21 13:10:10 -0500
committerNed Batchelder <ned@nedbatchelder.com>2009-11-21 13:10:10 -0500
commita61da141c1fa3d300f56956eb03db1de296f0680 (patch)
tree1136e2575859f150ebc971019284818bdd650411 /coverage/parser.py
parent28e24781321caf223fadd6ac3a11d15edd509fa9 (diff)
downloadpython-coveragepy-a61da141c1fa3d300f56956eb03db1de296f0680.tar.gz
Don't count branches to excluded code. Tests don't pass yet.
Diffstat (limited to 'coverage/parser.py')
-rw-r--r--coverage/parser.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/coverage/parser.py b/coverage/parser.py
index 4878bdb..eeed779 100644
--- a/coverage/parser.py
+++ b/coverage/parser.py
@@ -215,13 +215,18 @@ class CodeParser(object):
exit_counts = {}
for l1, l2 in self.arcs():
if l1 == -1:
+ # Don't ever report -1 as a line number
continue
if l1 in excluded_lines:
+ # Don't report excluded lines as line numbers.
+ continue
+ if l2 in excluded_lines:
+ # Arcs to excluded lines shouldn't count.
continue
if l1 not in exit_counts:
exit_counts[l1] = 0
exit_counts[l1] += 1
-
+
# Class definitions have one extra exit, so remove one for each:
for l in self.classdefs:
exit_counts[l] -= 1