From ae6df7f1aec2c1a21ef48a5cd2477e45bfaf1827 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 12 May 2026 23:49:27 +0000 Subject: [PATCH] Scope mutmut test selection to provider-specific test files mutmut 3.x removed tests_dir; the previous config silently fell back to running every test under tests/llm_translation/, letting unrelated providers' tests kill mutants in the target provider's code and inflating the kill score. Switch to pytest_add_cli_args_test_selection populated from the already-discovered test_files array, so the mutation run actually matches the scoping shown in the log line above it. --- scripts/e2e_llm_loop.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/e2e_llm_loop.sh b/scripts/e2e_llm_loop.sh index 4a26fab5328..ec1a05f0f4e 100755 --- a/scripts/e2e_llm_loop.sh +++ b/scripts/e2e_llm_loop.sh @@ -117,18 +117,25 @@ case "${mode}" in cp pyproject.toml "${pyproject_backup}" trap 'mv "${pyproject_backup}" pyproject.toml' EXIT + # Newline-delimited list of provider-scoped test files, consumed by the + # python heredoc below. Using an env var avoids quoting headaches when + # paths are interpolated into a TOML array. + TEST_FILES="$(printf '%s\n' "${test_files[@]}")" \ PROVIDER_SRC="${PROVIDER_SRC}" uv run --no-sync python - <<'PYEOF' +import json import os import re provider_src = os.environ["PROVIDER_SRC"] +test_files = [p for p in os.environ["TEST_FILES"].splitlines() if p] with open("pyproject.toml", "r") as f: content = f.read() +test_selection = ", ".join(json.dumps(p) for p in test_files) new_section = ( "[tool.mutmut]\n" f'paths_to_mutate = ["{provider_src}/"]\n' - 'tests_dir = ["tests/llm_translation/"]\n' + f'pytest_add_cli_args_test_selection = [{test_selection}]\n' 'also_copy = ["litellm/"]\n' 'pytest_add_cli_args = ["-p", "no:retry", "-p", "no:rerunfailures", "-p", "no:xdist"]\n' )