Repository navigation
🧪 test: narrow fstat mocks to the lock's descriptor - #893
Merged
Merged
Conversation
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.
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.
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.fstatbefore reading it (pytest #14687), and seven tests patchedos.fstatto 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.