Fix record_trampoline_hit when tmpdir changed working directory#527
Merged
Conversation
Collaborator
Author
|
The regression was added in 2bf799a |
Collaborator
Author
|
Closes #526 |
leynos
added a commit
to leynos/novel-ralph-skill
that referenced
this pull request
Jul 9, 2026
Enrol the repository in the estate-wide mutation-testing rollout as a thin caller of the leynos/shared-actions reusable mutmut workflow, pinned to 859416a90eb3987b46a57682c5d6b8964ad3f0a6. The run is informational: a daily scoped guard over recently changed modules at 12:35 UTC, plus full runs on manual dispatch. Configuration choices: - .github/workflows/mutation-testing.yml: empty default token scopes with contents: read and id-token: write on the job. The flat package layout sets paths to novel_ralph_skill/ and clears module-prefix-strip; python-version is "3.14" because requires-python is >= 3.14, above the workflow's 3.13 default. - pyproject.toml [tool.mutmut]: source_paths novel_ralph_skill/ and test selection tests/. also_copy lists the repo-root paths the suite reads at runtime (Makefile, README.md, docs/, skill/), because mutmut copies only tests/, pyproject.toml, and the source tree into its mutants/ sandbox. pytest_add_cli_args deselects the @slow installed-binary tier: those tests build a wheel from the working copy and run it in a fresh venv, where mutmut's trampoline import cannot resolve, so they abort the baseline rather than exercise mutants; the in-process tests cover the same command surface. - tests/test_workflow_contract.py: contract tests pinning the caller's uses SHA, least-privilege permissions, non-cancelling concurrency, schedule and dispatch triggers, and the exact with-block, guarded by a skipif for mutmut's sandbox (which does not copy .github/). - tests/_mutmut_compat.py, registered from tests/conftest.py: two workarounds, both no-ops outside mutmut runs. First, mutmut 3.6.0 re-resolves relative source_paths strictly against the current working directory on every trampoline hit (boxed/mutmut#526); many tests here chdir into per-test temporary trees, so stats collection aborted with FileNotFoundError. The plugin absolutises the cached configuration's paths at pytest_configure time while the working directory is still the sandbox root; remove once a release carries boxed/mutmut#527. Second, mutmut runs pytest repeatedly in one process, so class-based @given tests execute under a fresh instance per pass and trip Hypothesis's differing_executors health check on the second pass; a mutmut-only settings profile suppresses that check and lifts the per-example deadline (mutmut applies its own per-mutant timeout). - Dev dependencies: PyYAML (the contract test parses the caller) and mutmut (resolves the shim's guarded import and enables local runs). - .gitignore: ignore mutmut's mutants/ working directory. Co-authored-by: leynos <leynos@rohga>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, if a test changed the working directory, then mutmut would fail to resolve the source_paths because it used relative paths to the new working directory.
As a fix, we now resolve the path before running the tests, thus with the original working directory.