summaryrefslogtreecommitdiff
path: root/coverage/report.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-02-22 08:10:32 -0500
committerNed Batchelder <ned@nedbatchelder.com>2015-02-22 08:10:32 -0500
commit22f3e364c92776a0f10d1fb12b3dd8e685cb3293 (patch)
treea5d7edbe2e879bd8b6f0e1a68d89be47fe7a71e0 /coverage/report.py
parentb6a6dd3f9c2411b4dea4110fac0fcad4ec9b6d7d (diff)
downloadpython-coveragepy-22f3e364c92776a0f10d1fb12b3dd8e685cb3293.tar.gz
Remove every last trace of CodeUnit, and bring me a glass of vodka
Diffstat (limited to 'coverage/report.py')
-rw-r--r--coverage/report.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/coverage/report.py b/coverage/report.py
index 93b6c92..33a4607 100644
--- a/coverage/report.py
+++ b/coverage/report.py
@@ -19,40 +19,40 @@ class Reporter(object):
self.coverage = coverage
self.config = config
- # The code units to report on. Set by find_code_units.
- self.code_units = []
+ # The FileReporters to report on. Set by find_file_reporters.
+ self.file_reporters = []
# The directory into which to place the report, used by some derived
# classes.
self.directory = None
- def find_code_units(self, morfs):
- """Find the code units we'll report on.
+ def find_file_reporters(self, morfs):
+ """Find the FileReporters we'll report on.
`morfs` is a list of modules or filenames.
"""
- self.code_units = self.coverage._get_file_reporters(morfs)
+ self.file_reporters = self.coverage._get_file_reporters(morfs)
if self.config.include:
patterns = prep_patterns(self.config.include)
matcher = FnmatchMatcher(patterns)
filtered = []
- for cu in self.code_units:
- if matcher.match(cu.filename):
- filtered.append(cu)
- self.code_units = filtered
+ for fr in self.file_reporters:
+ if matcher.match(fr.filename):
+ filtered.append(fr)
+ self.file_reporters = filtered
if self.config.omit:
patterns = prep_patterns(self.config.omit)
matcher = FnmatchMatcher(patterns)
filtered = []
- for cu in self.code_units:
- if not matcher.match(cu.filename):
- filtered.append(cu)
- self.code_units = filtered
+ for fr in self.file_reporters:
+ if not matcher.match(fr.filename):
+ filtered.append(fr)
+ self.file_reporters = filtered
- self.code_units.sort()
+ self.file_reporters.sort()
def report_files(self, report_fn, morfs, directory=None):
"""Run a reporting function on a number of morfs.
@@ -60,29 +60,29 @@ class Reporter(object):
`report_fn` is called for each relative morf in `morfs`. It is called
as::
- report_fn(code_unit, analysis)
+ report_fn(file_reporter, analysis)
- where `code_unit` is the `CodeUnit` for the morf, and `analysis` is
- the `Analysis` for the morf.
+ where `file_reporter` is the `FileReporter` for the morf, and
+ `analysis` is the `Analysis` for the morf.
"""
- self.find_code_units(morfs)
+ self.find_file_reporters(morfs)
- if not self.code_units:
+ if not self.file_reporters:
raise CoverageException("No data to report.")
self.directory = directory
if self.directory and not os.path.exists(self.directory):
os.makedirs(self.directory)
- for cu in self.code_units:
+ for fr in self.file_reporters:
try:
- report_fn(cu, self.coverage._analyze(cu))
+ report_fn(fr, self.coverage._analyze(fr))
except NoSource:
if not self.config.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() and not self.config.ignore_errors:
+ if fr.should_be_python() and not self.config.ignore_errors:
raise