From db93205a36d4e55ae01c0c625c446b74e0438797 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 9 Aug 2015 09:58:18 -0400 Subject: Remove should_be_python from the FileReporter interface --- coverage/plugin.py | 9 --------- coverage/plugin_support.py | 5 ----- coverage/report.py | 2 ++ coverage/summary.py | 2 ++ 4 files changed, 4 insertions(+), 14 deletions(-) (limited to 'coverage') 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: -- cgit v1.2.1