summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-08-09 09:58:18 -0400
committerNed Batchelder <ned@nedbatchelder.com>2015-08-09 09:58:18 -0400
commitdb93205a36d4e55ae01c0c625c446b74e0438797 (patch)
tree251ad369b397d82df8815ea55ddb668087d4f1b4
parentd7f2c64b7071d20378d6864cc4ec1c1c83b09175 (diff)
downloadpython-coveragepy-git-db93205a36d4e55ae01c0c625c446b74e0438797.tar.gz
Remove should_be_python from the FileReporter interface
-rw-r--r--coverage/plugin.py9
-rw-r--r--coverage/plugin_support.py5
-rw-r--r--coverage/report.py2
-rw-r--r--coverage/summary.py2
4 files changed, 4 insertions, 14 deletions
diff --git a/coverage/plugin.py b/coverage/plugin.py
index 8cd6dd3f..c569d26d 100644
--- a/coverage/plugin.py
+++ b/coverage/plugin.py
@@ -214,12 +214,3 @@ class FileReporter(object):
# A generic implementation, each line is one "txt" token.
for line in self.source().splitlines():
yield [('txt', line)]
-
- def should_be_python(self):
- """Does it seem like this file should contain Python?
-
- This is used to decide if a file reported as part of the execution of
- a program was really likely to have contained Python in the first
- place.
- """
- return False
diff --git a/coverage/plugin_support.py b/coverage/plugin_support.py
index 23c1bc1a..92246d46 100644
--- a/coverage/plugin_support.py
+++ b/coverage/plugin_support.py
@@ -242,8 +242,3 @@ class DebugFileReporterWrapper(FileReporter):
ret = list(self.reporter.source_token_lines())
self.debug.write("source_token_lines() --> %d tokens" % (len(ret),))
return ret
-
- def should_be_python(self):
- ret = self.reporter.should_be_python()
- self.debug.write("should_be_python() --> %r" % (ret,))
- return ret
diff --git a/coverage/report.py b/coverage/report.py
index fa081862..1be4155d 100644
--- a/coverage/report.py
+++ b/coverage/report.py
@@ -87,5 +87,7 @@ class Reporter(object):
except NotPython:
# Only report errors for .py files, and only if we didn't
# explicitly suppress those errors.
+ # NotPython is only raised by PythonFileReporter, which has a
+ # should_be_python() method.
if fr.should_be_python() and not self.config.ignore_errors:
raise
diff --git a/coverage/summary.py b/coverage/summary.py
index 03270c04..7eb0f2fc 100644
--- a/coverage/summary.py
+++ b/coverage/summary.py
@@ -87,6 +87,8 @@ class SummaryReporter(Reporter):
report_it = not self.config.ignore_errors
if report_it:
typ, msg = sys.exc_info()[:2]
+ # NotPython is only raised by PythonFileReporter, which has a
+ # should_be_python() method.
if typ is NotPython and not fr.should_be_python():
report_it = False
if report_it: