diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-02-28 07:31:16 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-02-28 07:31:16 -0500 |
commit | f5d60436c51a47629d4afee8aa97ec69e5eeb9c7 (patch) | |
tree | db2d064c6edc868c26c9f37dd7d9cc885dad155e /coverage/summary.py | |
parent | 8750045b3dd2cd7530bb2795f2d7a36f89353225 (diff) | |
download | python-coveragepy-git-f5d60436c51a47629d4afee8aa97ec69e5eeb9c7.tar.gz |
refactor: remove unused exception handling
Diffstat (limited to 'coverage/summary.py')
-rw-r--r-- | coverage/summary.py | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/coverage/summary.py b/coverage/summary.py index 0c7fa551..65f80470 100644 --- a/coverage/summary.py +++ b/coverage/summary.py @@ -8,7 +8,7 @@ import sys from coverage import env from coverage.report import get_analysis_to_report from coverage.results import Numbers -from coverage.misc import NotPython, CoverageException, output_encoding +from coverage.misc import CoverageException, output_encoding class SummaryReporter(object): @@ -78,29 +78,18 @@ class SummaryReporter(object): lines = [] for (fr, analysis) in self.fr_analysis: - try: - nums = analysis.numbers - - args = (fr.relative_filename(), nums.n_statements, nums.n_missing) - if self.branches: - args += (nums.n_branches, nums.n_partial_branches) - args += (nums.pc_covered_str,) - if self.config.show_missing: - args += (analysis.missing_formatted(branches=True),) - text = fmt_coverage % args - # Add numeric percent coverage so that sorting makes sense. - args += (nums.pc_covered,) - lines.append((text, args)) - except Exception: - 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: - self.writeout(self.fmt_err % (fr.relative_filename(), typ.__name__, msg)) + nums = analysis.numbers + + args = (fr.relative_filename(), nums.n_statements, nums.n_missing) + if self.branches: + args += (nums.n_branches, nums.n_partial_branches) + args += (nums.pc_covered_str,) + if self.config.show_missing: + args += (analysis.missing_formatted(branches=True),) + text = fmt_coverage % args + # Add numeric percent coverage so that sorting makes sense. + args += (nums.pc_covered,) + lines.append((text, args)) # Sort the lines and write them out. if getattr(self.config, 'sort', None): |