Answer stability round 2: 1 🔴, 0 🟡 (0 misread); pin diff.interHunkContext too
CI / tests (pull_request) Failing after 4m18s
CI / tests (pull_request) Failing after 4m18s
This commit is contained in:
@@ -14,8 +14,9 @@ CARGO_FINISHED = frozenset({0, 2, 3})
|
||||
CARGO_OUTCOMES = ("caught", "missed", "timeout", "unviable")
|
||||
GREMLINS_UNKILLED = frozenset({"LIVED", "NOT COVERED"})
|
||||
# What Gremlins v0.6.0 needs of the diff it reads from git: one run of lines per hunk is all it mutates, so a hunk holds the changed
|
||||
# lines and none around them; it takes each file's path after a b/; and it reads no colour codes. A user's git settings change each.
|
||||
GREMLINS_GIT_SETTINGS = {"diff.context": "0", "diff.noprefix": "false", "diff.mnemonicPrefix": "false", "diff.srcPrefix": "a/", "diff.dstPrefix": "b/", "color.diff": "never"}
|
||||
# lines and none around them, nor a neighbouring change; it takes each file's path after a b/; and it reads no colour codes. A user's git
|
||||
# settings change each.
|
||||
GREMLINS_GIT_SETTINGS = {"diff.context": "0", "diff.noprefix": "false", "diff.mnemonicPrefix": "false", "diff.srcPrefix": "a/", "diff.dstPrefix": "b/", "color.diff": "never", "diff.interHunkContext": "0"}
|
||||
|
||||
|
||||
def run_cargo_mutants(top: str, base: str, paths: list[str], run: Run, git: Git, jobs: int) -> list[str] | Failure:
|
||||
|
||||
@@ -18,7 +18,7 @@ or __tests__/ folder.
|
||||
becomes one line for its folder, naming the error and telling you to mutate that folder's changed lines by hand.
|
||||
- .go: Gremlins, as `gremlins unleash --diff`, in the checkout's top, where its go.mod must be. Gremlins reads the diff from git, so
|
||||
the run adds settings to the GIT_CONFIG_* variables, after any the environment holds: no context lines, since Gremlins mutates
|
||||
every line of a hunk; a/ and b/ as the file prefixes; and no colour.
|
||||
every line of a hunk, so one hunk per change; a/ and b/ as the file prefixes; and no colour.
|
||||
- .rs: cargo-mutants, as `cargo mutants --in-diff`, in the checkout's top.
|
||||
- .cjs, .cts, .js, .jsx, .mjs, .mts, .ts, .tsx: Stryker, as `npx --no --package=@stryker-mutator/core stryker run --mutate` on the
|
||||
changed lines, in the nearest folder above the file that holds a package.json. A file with no package.json above it isn't
|
||||
|
||||
@@ -151,16 +151,16 @@ class InDiffTools(unittest.TestCase):
|
||||
def test_the_git_settings_gremlins_needs_are_added_after_the_ones_the_environment_holds(self):
|
||||
held = {"HOME": "/h", "GIT_CONFIG_COUNT": "1", "GIT_CONFIG_KEY_0": "safe.directory", "GIT_CONFIG_VALUE_0": "*"}
|
||||
env = with_plain_git_diff(held)
|
||||
self.assertEqual(env["GIT_CONFIG_COUNT"], "7")
|
||||
self.assertEqual({name: value for name, value in env.items() if name in held}, held | {"GIT_CONFIG_COUNT": "7"})
|
||||
settings = [(env[f"GIT_CONFIG_KEY_{index}"], env[f"GIT_CONFIG_VALUE_{index}"]) for index in range(1, 7)]
|
||||
self.assertEqual(settings, [("diff.context", "0"), ("diff.noprefix", "false"), ("diff.mnemonicPrefix", "false"), ("diff.srcPrefix", "a/"), ("diff.dstPrefix", "b/"), ("color.diff", "never")])
|
||||
self.assertEqual(env["GIT_CONFIG_COUNT"], "8")
|
||||
self.assertEqual({name: value for name, value in env.items() if name in held}, held | {"GIT_CONFIG_COUNT": "8"})
|
||||
settings = [(env[f"GIT_CONFIG_KEY_{index}"], env[f"GIT_CONFIG_VALUE_{index}"]) for index in range(1, 8)]
|
||||
self.assertEqual(settings, [("diff.context", "0"), ("diff.noprefix", "false"), ("diff.mnemonicPrefix", "false"), ("diff.srcPrefix", "a/"), ("diff.dstPrefix", "b/"), ("color.diff", "never"), ("diff.interHunkContext", "0")])
|
||||
|
||||
def test_the_git_settings_start_at_the_first_for_an_environment_without_a_count_or_with_one_that_is_not_a_number(self):
|
||||
for held in ({}, {"GIT_CONFIG_COUNT": "many"}, {"GIT_CONFIG_COUNT": ""}):
|
||||
with self.subTest(held):
|
||||
env = with_plain_git_diff(held)
|
||||
self.assertEqual((env["GIT_CONFIG_COUNT"], env["GIT_CONFIG_KEY_0"], env["GIT_CONFIG_KEY_5"], "GIT_CONFIG_KEY_6" in env), ("6", "diff.context", "color.diff", False))
|
||||
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))
|
||||
|
||||
|
||||
class MutmutSetup(unittest.TestCase):
|
||||
|
||||
@@ -433,9 +433,9 @@ class MutateChangesRuns(unittest.TestCase):
|
||||
self.assertEqual(folder, str(self.checkout.resolve()))
|
||||
base = self.git("rev-parse", "HEAD").strip()
|
||||
self.assertRegex(command, rf"^gremlins unleash --diff {base} --output (\.mutate-changes-\w+)/report\.json --workers 3$")
|
||||
keys = ["diff.context", "diff.noprefix", "diff.mnemonicPrefix", "diff.srcPrefix", "diff.dstPrefix", "color.diff"]
|
||||
values = ["0", "false", "false", "a/", "b/", "never"]
|
||||
self.assertEqual(config, "GIT_CONFIG_COUNT=6\n" + "".join(f"GIT_CONFIG_KEY_{n}={key}\n" for n, key in enumerate(keys)) + "".join(f"GIT_CONFIG_VALUE_{n}={value}\n" for n, value in enumerate(values)))
|
||||
keys = ["diff.context", "diff.noprefix", "diff.mnemonicPrefix", "diff.srcPrefix", "diff.dstPrefix", "color.diff", "diff.interHunkContext"]
|
||||
values = ["0", "false", "false", "a/", "b/", "never", "0"]
|
||||
self.assertEqual(config, "GIT_CONFIG_COUNT=7\n" + "".join(f"GIT_CONFIG_KEY_{n}={key}\n" for n, key in enumerate(keys)) + "".join(f"GIT_CONFIG_VALUE_{n}={value}\n" for n, value in enumerate(values)))
|
||||
self.assertEqual(sorted(path.name for path in self.checkout.iterdir()), [".git", "README.md", "calc.go", "calc_test.go", "pkg"])
|
||||
|
||||
def test_a_gremlins_run_that_finds_no_mutant_reports_none(self):
|
||||
|
||||
Reference in New Issue
Block a user