From 67ea897f611a86fee7e3846ad3c4bc564cac6264 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 18 Apr 2012 07:27:59 -0400 Subject: Don't complain about files that can't be parsed as Python if they didn't seem like Python at all. #82. --- coverage/report.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'coverage/report.py') diff --git a/coverage/report.py b/coverage/report.py index 6c5510ad..5d187996 100644 --- a/coverage/report.py +++ b/coverage/report.py @@ -84,6 +84,11 @@ class Reporter(object): for cu in self.code_units: try: report_fn(cu, self.coverage._analyze(cu)) - except (NoSource, NotPython): + except NoSource: if not self.ignore_errors: raise + except NotPython: + # Only report errors for .py files, and only if we didn't + # explicitly suppress those errors. + if cu.should_be_python(".py") and not self.ignore_errors: + raise -- cgit v1.2.1