Run mutate-changes on a script its tests import by file name, and name a crash inside mutmut in one line
This commit is contained in:
@@ -10,10 +10,11 @@ import posixpath
|
||||
import shutil
|
||||
import tomllib
|
||||
|
||||
from mutate_changes.bare_imports import imported_by_file_name
|
||||
from mutate_changes.changed_lines import by_folder, label
|
||||
from mutate_changes.tool_process import failed, Ran, remove, Run, scratch_folder
|
||||
from failure import Failure
|
||||
from mutate_changes.mutmut_mutants import function_keys, mutant_globs, mutated_line, named, statuses
|
||||
from mutate_changes.mutmut_mutants import crash_in_mutmut, function_keys, mutant_globs, mutated_line, named, statuses
|
||||
from git_cli.git_repo import Git
|
||||
from mutate_changes.mutmut_setup import left_out, mutmut_config
|
||||
|
||||
@@ -47,7 +48,7 @@ def run_mutmut(top: str, changed: dict[str, frozenset[int]], run: Run, git: Git,
|
||||
|
||||
changed maps each file, by its path from top, to its changed lines."""
|
||||
report: list[str] = []
|
||||
for path, files in sorted(by_folder(top, changed, CONFIGS).items()):
|
||||
for path, files in sorted(imported_by_file_name(top, by_folder(top, changed, CONFIGS), CONFIGS).items()):
|
||||
lines = mutate_folder(top, path, files, run, git, jobs)
|
||||
if isinstance(lines, Failure):
|
||||
return lines
|
||||
@@ -152,6 +153,9 @@ def run_until_stats_pass(copy: str, copied: list[str], folder: Folder, argv: lis
|
||||
if isinstance(ran, Failure):
|
||||
return ran
|
||||
if ran.code and NO_MUTANT not in ran.output and NO_TEST not in ran.output:
|
||||
crash = crash_in_mutmut(ran.output)
|
||||
if crash:
|
||||
return Failure(f"mutmut crashed in {folder.label} with {crash}: mutate the changed lines of {folder.label} by hand.")
|
||||
return failed(f"mutmut run in {folder.label}", ran)
|
||||
return ran.output, left
|
||||
|
||||
|
||||
Reference in New Issue
Block a user