Answer stability round 1: 0 🔴, 5 🟡 (0 misread); run both tools in a scratch copy, read Infection's two sources, end PHPUnit's list, spell glob characters

This commit is contained in:
2026-11-26 11:42:20 +01:00
parent 76de4fa497
commit 874e417e27
8 changed files with 268 additions and 169 deletions
+13 -1
View File
@@ -17,12 +17,12 @@ from mutate_changes.changed_lines import added_lines, by_folder, not_mutated, ru
from mutate_changes.mutmut_tool import copy_files, Ended, Folder, mutate_folder, NO_MUTANT, reported
from mutate_changes.mutmut_mutants import crash_in_mutmut, function_keys, mutant_globs, mutated_lines, named, statuses
from failure import Failure
from mutate_changes.in_diff_tools import glob_escaped, run_stryker, with_plain_git_diff
from mutate_changes.bare_imports import imported_by_file_name
from test_env import isolated_env
from mutate_changes.mutmut_setup import left_out, mutmut_config
from mutate_changes import main
from mutate_changes.tool_process import Ran, run_tool, scratch_folder
from mutate_changes.in_diff_tools import with_plain_git_diff
SOURCE = "def double(n):\n\treturn n * 2\n\n\nclass Pt:\n\tdef moved(self, by=1):\n\t\treturn self.x + by\n"
# The shape of the file mutmut 3 writes under mutants/: the original of each function and its mutants, with the original's lines.
@@ -163,6 +163,18 @@ class InDiffTools(unittest.TestCase):
self.assertEqual((env["GIT_CONFIG_COUNT"], env["GIT_CONFIG_KEY_0"], env["GIT_CONFIG_KEY_6"], "GIT_CONFIG_KEY_7" in env), ("7", "diff.context", "diff.interHunkContext", False))
def test_a_path_goes_to_stryker_with_a_question_mark_for_each_character_a_glob_gives_a_meaning(self):
self.assertEqual(glob_escaped("app/[slug]/(shop)/{a}/b!c*d+e@f.tsx"), "app/?slug?/?shop?/?a?/b?c?d?e?f.tsx")
self.assertEqual(glob_escaped("src/pick-one_two.test.ts"), "src/pick-one_two.test.ts")
def test_stryker_is_handed_a_changed_file_whose_path_holds_a_globs_characters_as_a_glob_that_matches_it(self):
with tempfile.TemporaryDirectory() as top:
pathlib.Path(top, "package.json").write_text("{}")
ran: list[list[str]] = []
run_stryker(top, {"app/[slug]/page.tsx": frozenset({3, 4})}, lambda argv, cwd: ran.append(argv) or Ran(0, ""), 1)
self.assertEqual(ran[0][5:7], ["--mutate", "app/?slug?/page.tsx:3-4"])
class MutmutSetup(unittest.TestCase):
def test_the_config_mutates_the_sources_and_copies_each_entry_of_the_folder(self):
for existing in ("", "[mutmut]\nsource_paths = old.py\nalso_copy = old\n"):