-
Notifications
You must be signed in to change notification settings - Fork 1
bug: mutation testing workflow fails with mutmut 3.x incompatibilities #330
Description
Bug Description
The weekly mutation testing workflow (mutation.yml) fails due to three mutmut 3.x incompatibilities:
-
Config type mismatch:
paths_to_mutate = "src/"(string) inpyproject.tomlis iterated as individual characters by mutmut 3.x, producing['s', 'r', 'c', '/']. The'/'becomesPosixPath('/'), causing mutmut to walk the entire filesystem and crash on dangling symlinks or permission errors. -
mutmut htmlremoved: The workflow andtask_mutate_htmldoit task callmutmut htmlwhich no longer exists in 3.x. -
clear=Trueenv patching breaks mutmut: Tests usingpatch.dict("os.environ", {}, clear=True)strip theMUTANT_UNDER_TESTenv var that mutmut 3.x requires, causing mutmut's initial test run to fail withKeyError: 'MUTANT_UNDER_TEST'and aborting before any mutants are tested.
Steps to Reproduce
- Set
paths_to_mutate = "src/"(string) in[tool.mutmut]section ofpyproject.toml - Have a test that uses
patch.dict("os.environ", {}, clear=True) - Run
mutmut run - Mutmut crashes walking
/, or if that's fixed, aborts because initial test run fails
Expected vs Actual Behavior
Expected: Mutation testing scopes to src/ directory, initial test run passes, mutants are tested.
Actual: Multiple failures:
- Mutmut walks entire filesystem due to string iteration of
paths_to_mutate - Tests that clear the environment break mutmut's internal
MUTANT_UNDER_TESTcheck - All mutants report "not checked"
Environment
- mutmut: 3.5.0
- Runner: ubuntu-latest (Ubuntu 24.04)
- Python: 3.14
Error Output
Config issue:
FileNotFoundError: [Errno 2] No such file or directory: '/etc/systemd/system/multi-user.target.wants/apport.service'
Environment clearing issue:
FAILED tests/unit/cli/test_completion.py::TestDetectShell::test_detect_no_shell_env - KeyError: 'MUTANT_UNDER_TEST'
Additional Context
- Root cause for config:
paths_to_mutate = "src/"must bepaths_to_mutate = ["src/"](list). Same fortests_dir. - Root cause for env: Tests using
patch.dict("os.environ", {}, clear=True)must preserveMUTANT_UNDER_TESTwhen it exists, e.g.patch.dict("os.environ", {k: v for k, v in os.environ.items() if k == "MUTANT_UNDER_TEST"}, clear=True) mutmut htmlremoved in 3.x;task_mutate_htmldoit task must be removed- Workflow needs
mkdir -p tmpand artifact path updated from HTML dir to text file - Fix validated in bug: mutation testing workflow fails with mutmut 3.x incompatibilities infrafoundry#485