diff options
| author | Ned Batchelder <ned@nedbatchelder.com> | 2009-11-21 13:10:10 -0500 |
|---|---|---|
| committer | Ned Batchelder <ned@nedbatchelder.com> | 2009-11-21 13:10:10 -0500 |
| commit | b8c23d479ae5a0da883a59d433193533c7ef63e4 (patch) | |
| tree | d7c40cace860a55a91b1b9c20de0bc664f769cc9 /coverage | |
| parent | 9ce4e0e787c7e8f028a2c2f56c50b6d8f663e88c (diff) | |
| download | python-coveragepy-git-b8c23d479ae5a0da883a59d433193533c7ef63e4.tar.gz | |
Don't count branches to excluded code. Tests don't pass yet.
Diffstat (limited to 'coverage')
| -rw-r--r-- | coverage/parser.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/coverage/parser.py b/coverage/parser.py index 4878bdb5..eeed779a 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 |
