Skip to content

Commit f5d6043

Browse files
committed
refactor: remove unused exception handling
1 parent 8750045 commit f5d6043

File tree

1 file changed

+13
-24
lines changed

1 file changed

+13
-24
lines changed

coverage/summary.py

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from coverage import env
99
from coverage.report import get_analysis_to_report
1010
from coverage.results import Numbers
11-
from coverage.misc import NotPython, CoverageException, output_encoding
11+
from coverage.misc import CoverageException, output_encoding
1212

1313

1414
class SummaryReporter(object):
@@ -78,29 +78,18 @@ def report(self, morfs, outfile=None):
7878
lines = []
7979

8080
for (fr, analysis) in self.fr_analysis:
81-
try:
82-
nums = analysis.numbers
83-
84-
args = (fr.relative_filename(), nums.n_statements, nums.n_missing)
85-
if self.branches:
86-
args += (nums.n_branches, nums.n_partial_branches)
87-
args += (nums.pc_covered_str,)
88-
if self.config.show_missing:
89-
args += (analysis.missing_formatted(branches=True),)
90-
text = fmt_coverage % args
91-
# Add numeric percent coverage so that sorting makes sense.
92-
args += (nums.pc_covered,)
93-
lines.append((text, args))
94-
except Exception:
95-
report_it = not self.config.ignore_errors
96-
if report_it:
97-
typ, msg = sys.exc_info()[:2]
98-
# NotPython is only raised by PythonFileReporter, which has a
99-
# should_be_python() method.
100-
if typ is NotPython and not fr.should_be_python():
101-
report_it = False
102-
if report_it:
103-
self.writeout(self.fmt_err % (fr.relative_filename(), typ.__name__, msg))
81+
nums = analysis.numbers
82+
83+
args = (fr.relative_filename(), nums.n_statements, nums.n_missing)
84+
if self.branches:
85+
args += (nums.n_branches, nums.n_partial_branches)
86+
args += (nums.pc_covered_str,)
87+
if self.config.show_missing:
88+
args += (analysis.missing_formatted(branches=True),)
89+
text = fmt_coverage % args
90+
# Add numeric percent coverage so that sorting makes sense.
91+
args += (nums.pc_covered,)
92+
lines.append((text, args))
10493

10594
# Sort the lines and write them out.
10695
if getattr(self.config, 'sort', None):

0 commit comments

Comments
 (0)