Skip to content

🧪 test: narrow fstat mocks to the lock's descriptor - #893

Merged
gaborbernat merged 1 commit into
mainfrom
fix/pytest-9.2-fstat-patches
Oct 28, 2026
Merged

gaborbernat merged 1 commit into
mainfrom
fix/pytest-9.2-fstat-patches

Conversation

@gaborbernat

Copy link
Copy Markdown
Member

Every CI job has been red since pytest 9.2.0 reached the test environments: its fd-level capture now checks the capture file with os.fstat before reading it (pytest #14687), and seven tests patched os.fstat to raise or return a fake for every descriptor, so the mock fired inside pytest once the test's call phase ended.

🧪 Each of those mocks now targets only the descriptor the lock opened and hands every other call to the real os.fstat, the shape the rest of the suite already uses. The suite passes on pytest 9.2.0 and 9.1.1 alike, and the tests keep asserting the same outcomes.

pytest 9.2.0 checks its capture file with os.fstat before reading it
(pytest-dev/pytest#14687), so a test whose os.fstat mock still raises or
returns a fake for every descriptor when the call phase ends fails inside
pytest's capture code. Seven tests patched os.fstat that way; the rest of
the suite already hands descriptors it does not target to the real
os.fstat.

Each of the seven now identifies the lock's descriptor (the file the lock
opened, the held marker's identity, or the private record the strict lock
created) and fails only that call, so the mock no longer depends on when
pytest reads its capture buffer.
@gaborbernat gaborbernat added the skip news Internal change; exempt from the news fragment check label Oct 28, 2026
@gaborbernat
gaborbernat merged commit 65f5ea0 into main Oct 28, 2026
52 of 53 checks passed
@gaborbernat
gaborbernat deleted the fix/pytest-9.2-fstat-patches branch October 28, 2026 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news Internal change; exempt from the news fragment check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant