diff options
Diffstat (limited to 'coverage/parser.py')
-rw-r--r-- | coverage/parser.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/coverage/parser.py b/coverage/parser.py index de0e0c7f..01b38af3 100644 --- a/coverage/parser.py +++ b/coverage/parser.py @@ -222,8 +222,10 @@ class CodeParser(object): # Class definitions have one extra exit, so remove one for each: for l in self.classdefs: - exit_counts[l] -= 1 - + # Ensure key is there - #pragma: no cover will mean its not + if l in exit_counts: + exit_counts[l] -= 1 + return exit_counts exit_counts = expensive(exit_counts) |