Skip to content

v0.14.0 — mutation modes: stop-first dispatch, fresh-worker isolation

Choose a tag to compare

@prostomarkeloff prostomarkeloff released this 15 Jul 21:09
· 18 commits to main since this release

Mutation runs on warm workers

Two new wrapper-client execution modes over the persistent-worker protocol, built for mutation testing: thousands of short ordered runs against the same suite, where the win is not re-paying the pytest lifecycle and not running past an already-found killer.

stop_on_failure — stop at the first observed failure

request_run(addr, nodeids=[...], stop_on_failure=True) makes a --persist-workers daemon stop dispatching the ordered selection after the first failed/error result. Already-dispatched items finish; the tail is never issued.

  • A trusted short-circuit is reported in run_meta: total (actually dispatched), planned_total (original selection), short_circuited. The scheduler never invents a failure — an early stop is trusted only when backed by a real failed/error result; any other shortfall stays UNTRUSTED.
  • Dispatch switches to eager mode with a per-worker lookahead reservation, so pytest's nextitem fixture semantics survive: module/class fixtures shared by adjacent selected items are set up once, and a short-circuit tears the boundary down to session scope.
  • Requires a --persist-workers daemon; cannot be combined with benchmark mode. request_run_streamed(..., stop_on_failure=True) exposes the same contract for report-consuming tools.

fresh_workers — per-request process isolation

request_run(addr, nodeids=[...], fresh_workers=True) retires the resident pool and runs this request in a newly forked worker — a fresh pytest session per request — while the daemon's completed collection and forkserver controller stay resident. A later ordinary request lazily re-creates the persistent pool. An empty selection works as a cheap barrier that closes session resources (e.g. before resetting an external database). Cannot be combined with stop_on_failure or benchmark mode.

Explicit capability negotiation

Both modes are trailing protocol fields with a mandatory acknowledgement: the daemon confirms the contract in its final frame, and a 0.14+ client rejects an unacknowledged response with rc=2 — an older daemon can never silently run a weaker contract.

Fail-closed selection

A requested nodeid absent from the daemon's collection now rejects the whole request with rc=2 before any selected test runs — on both the persistent and fork-per-request paths. A stale selection can no longer read as an empty green run.

Persistent-session boundary hardening

Between persistent requests only session-scoped fixtures survive: the boundary anchor is now a genuine pytest Item parented directly to the Session, so third-party pytest_runtest_protocol/teardown hooks keep their declared contract, and the previous behavior of the first collected item's module fixtures leaking across requests is gone.

Effect

On a downstream mutation workload over an identical mutant set: roughly 6–11× end-to-end against the original baseline; an isolated parallel mutation lane shows ~2.7× wall-time and ~4.1× on the execution phase with exactly matching outcome statuses. For a stream of N requests, session-scoped setup amortizes from N to one per persistent session.

Verification

Integration tests for stop-first dispatch (single- and multi-worker lookahead), fixture lifecycle across request boundaries, fail-closed unknown nodeids on both paths, capability negotiation against a legacy daemon (both clients), and mode-combination rejections. Gates: make lint-heavy, make test-full (123 passed).