diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2012-04-18 07:27:59 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2012-04-18 07:27:59 -0400 |
commit | 42f5efa9bc9e5ec2fd02f9cf6b95541a93fca632 (patch) | |
tree | 28baf3d41e7a89c1082a9b6e9138474a50a0124e /coverage/report.py | |
parent | ac8cf1852de2837234dab8cc823127e70c48e55e (diff) | |
download | python-coveragepy-42f5efa9bc9e5ec2fd02f9cf6b95541a93fca632.tar.gz |
Don't complain about files that can't be parsed as Python if they didn't seem like Python at all. #82.
Diffstat (limited to 'coverage/report.py')
-rw-r--r-- | coverage/report.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/coverage/report.py b/coverage/report.py index 6c5510a..5d18799 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 |