|
8 | 8 | from coverage import env |
9 | 9 | from coverage.report import get_analysis_to_report |
10 | 10 | from coverage.results import Numbers |
11 | | -from coverage.misc import NotPython, CoverageException, output_encoding |
| 11 | +from coverage.misc import CoverageException, output_encoding |
12 | 12 |
|
13 | 13 |
|
14 | 14 | class SummaryReporter(object): |
@@ -78,29 +78,18 @@ def report(self, morfs, outfile=None): |
78 | 78 | lines = [] |
79 | 79 |
|
80 | 80 | 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)) |
104 | 93 |
|
105 | 94 | # Sort the lines and write them out. |
106 | 95 | if getattr(self.config, 'sort', None): |
|
0 commit comments