Skip to content

Keep usefixtures fixtures ahead of autouse dependencies - #14993

Closed
wolfgang-aura wants to merge 1 commit into
pytest-dev:mainfrom
wolfgang-aura:mailman/issue-14992
Closed

Keep usefixtures fixtures ahead of autouse dependencies#14993
wolfgang-aura wants to merge 1 commit into
pytest-dev:mainfrom
wolfgang-aura:mailman/issue-14992

Conversation

@wolfgang-aura

Copy link
Copy Markdown

Closes #14992.

Pytest 9.1 changed fixture-closure construction so a fixture requested with
usefixtures can be set up after the dependencies of an earlier autouse
fixture. This can move a guard or other setup action after the work it was
intended to protect.

The regression came from traversing every initial fixture name depth-first
before honoring the established order of the initial requests. The fix keeps
the initial fixture names ahead of their transitive dependencies, preserves
scope ordering for the expanded closure, updates the affected order
expectations, adds a regression test for the reported setup order, and records
the behavior in a bug-fix changelog entry.

How this was tested

At the reported base commit 3fd8675d6d798507c06cf9c60753be6d9d7b0e17, the
machine-checked reproduction failed with the observed order
['precondition', 'subject_deps', 'guard', 'subject']. After the change, the
final independent fixture-suite verification reported 241 passed, 3 xfailed.

The checks ran on Windows 11. Mailman recorded Python 3.14.3 for the host
command metadata. A separate reviewer probe of nested pytester invocations
encountered existing Windows cache-permission failures in unrelated cases; the
issue-specific regression passed independently.

An alternative not taken

The implementation could special-case only usefixtures names after the
depth-first traversal. Restoring the initial-name prefix keeps the established
precedence rule in the shared closure algorithm and avoids a second ordering
mechanism, while the existing scope sort still handles the expanded fixture
set.

AI disclosure

This change was drafted with AI assistance: codex (gpt-5.6-luna) wrote the
patch and codex (gpt-5.6-luna) reviewed it under Mailman. The test results
above were executed by the Mailman harness. Human review and filing remain
pending.

@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Sep 9, 2026
@bluetech bluetech closed this Sep 9, 2026
wolfgang-aura pushed a commit to wolfgang-aura/Mailman that referenced this pull request Sep 9, 2026
`prepare-submission` writes `pull-request.md` for the person preparing the
submission: placeholder paragraphs, a "Before filing" checklist, a suggested
branch. Whatever survives the rewrite into the final body is read by a
maintainer as part of the argument for the change, and nothing checked for it.
pytest-dev/pytest#14993 was filed with the alternative-not-taken heading, the
host-environment section, and "Human review and filing remain pending" still
in the body.

Adds `draft_leftovers` to mailman/handoff.py, in three families: draft
scaffolding, sentences saying the work is still pending, and references to run
IDs or `.mailman` paths. `handoff` exits non-zero and prints the offending
lines under DRAFT LEFTOVERS; `handoff-check` refuses with reason
`draft-leftovers`, the same shape as the existing first-person-claim gate. The
pending and internal families are matched per paragraph, because a sentence
that survives a rewrite gets re-wrapped and a line-at-a-time search misses it.

Length is deliberately not judged: whether a section earns its place is the
writer's call, and the standard still asks for host limits to be stated.

Records in docs/runs/0010 that nothing was posted upstream on the pytest issue
and why.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HkBjZjTgi45fqneyWicr3L
wolfgang-aura added a commit to wolfgang-aura/Mailman that referenced this pull request Sep 11, 2026
`claims` now records when the issue closed, who reported it and whether a
maintainer has replied. `handoff-check` refuses a pull request whose
issue is closed; `handoff` prints an UNTRIAGED ISSUE section when the
reporter is outside the project and nobody who speaks for it has
answered.

pdm-project/pdm#3884 was filed nine hours after its maintainer closed
the issue, with the state already in claims.json. pytest-dev/pytest#14993
was filed on a thirteen-hour-old outside report whose premise the
reporter later withdrew. Both closed without a word. Closes #88.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9.1: a usefixtures fixture is no longer set up before an earlier autouse fixture's dependencies

2 participants