Skip to content

Commit b6fc4bc

Browse files
authored
copy full src dir before creating mutants (#372)
* copy full src dir before creating mutants current process only copies python files * use copytree instead * remove commented code, undo print addon
1 parent 04f0735 commit b6fc4bc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

mutmut/__main__.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ def _mutmut_trampoline(orig, mutants, *args, **kwargs):
219219
"""
220220
yield_from_trampoline_impl = trampoline_impl.replace('result = ', 'result = yield from ').replace('_mutmut_trampoline', '_mutmut_yield_from_trampoline')
221221

222+
def copy_src_dir():
223+
for path in mutmut.config.paths_to_mutate:
224+
output_path = Path('mutants') / path
225+
shutil.copytree(path, output_path, dirs_exist_ok=True)
222226

223227
def create_mutants():
224228
for path in walk_source_files():
@@ -257,10 +261,6 @@ def pragma_no_mutate_lines(source):
257261
def create_mutants_for_file(filename, output_path):
258262
input_stat = os.stat(filename)
259263

260-
if output_path.exists() and output_path.stat().st_mtime == input_stat.st_mtime:
261-
# print(' skipped', output_path, 'already up to date')
262-
return
263-
264264
with open(filename) as f:
265265
source = f.read()
266266

@@ -1230,6 +1230,7 @@ def run(mutant_names, *, max_children):
12301230
start = datetime.now()
12311231
makedirs(Path('mutants'), exist_ok=True)
12321232
with CatchOutput(spinner_title='Generating mutants'):
1233+
copy_src_dir()
12331234
create_mutants()
12341235
copy_also_copy_files()
12351236

0 commit comments

Comments
 (0)