Skip to content

Commit 94cff9a

Browse files
committed
fix mutate_only_covered_lines when files are excluded from test run
1 parent fef6d4a commit 94cff9a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

mutmut/code_coverage.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ def gather_coverage(runner, source_files):
4646
abs_filename = str((mutants_path / filename).absolute())
4747
lines = coverage_data.lines(abs_filename)
4848
if lines is None:
49-
raise Exception(f'Could not collect coverage for file {abs_filename}. '
50-
'Please create a MRE and file an issue.'
51-
f'Collected coverage from following files: {coverage_data.measured_files()}')
49+
# file was not imported during test run, e.g. because test selection excluded this file
50+
lines = []
5251
covered_lines[abs_filename] = list(lines)
5352

5453
_unload_modules_not_in(modules)

0 commit comments

Comments
 (0)