diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-02-22 08:10:32 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-02-22 08:10:32 -0500 |
commit | 995debcded55817348cc640cac8ea07ca12bd57c (patch) | |
tree | 8adc20ab1e5acf92abcb1cb62d16ffc011b0cb22 /coverage/report.py | |
parent | 73cb722150e74d123df152ff1b40e55972ccbafb (diff) | |
download | python-coveragepy-git-995debcded55817348cc640cac8ea07ca12bd57c.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.py | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/coverage/report.py b/coverage/report.py index 93b6c928..33a46070 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 |