Skip to content

Fix record_trampoline_hit when tmpdir changed working directory#527

Merged
Otto-AA merged 1 commit into
mainfrom
fix-tmpdir
Jun 10, 2026
Merged

Fix record_trampoline_hit when tmpdir changed working directory#527
Otto-AA merged 1 commit into
mainfrom
fix-tmpdir

Conversation

@Otto-AA

@Otto-AA Otto-AA commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

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.

@Otto-AA

Otto-AA commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator Author

The regression was added in 2bf799a

@Otto-AA Otto-AA merged commit c01561b into main Jun 10, 2026
10 checks passed
@Otto-AA

Otto-AA commented Jun 10, 2026

Copy link
Copy Markdown
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant