From e9f83b2bb467204bb6bbbfa0550b8b9fd19c9c7b Mon Sep 17 00:00:00 2001 From: "rozza@x103086.gcapmedia.com" Date: Fri, 20 Nov 2009 10:07:23 +0000 Subject: Ensuring that Class definitions exit counts are correct when you use #pragma: no cover for the class --- coverage/parser.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'coverage/parser.py') 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) -- cgit v1.2.1