Conversation
Use an explicit DFS stack for fixture closures and avoid legacy nodeid lookups when fixtures use node-based registration. Preserve override ordering and add deep-closure collection tests and a unittest benchmark. Co-authored-by: OpenAI Codex <noreply@openai.com>
Co-authored-by: OpenAI Codex <noreply@openai.com>
host452b
marked this pull request as ready for review
September 18, 2026 07:08
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.
Large unittest suites repeatedly traverse the same small fixture dependency graphs during collection. This reduces that per-item overhead without caching fixture state or deferring test-case construction.
Measurements
Five alternating baseline/patched pairs, Python 3.12.3, median elapsed time for the complete
pytest --collect-only -qsubprocess (including startup and shutdown), without profiling hooks:test_ops.py, 34,525 itemsbench/unittest_methods.py, 35,000 itemsRanges: PyTorch 14.501–15.133 s / 14.066–14.377 s; generated unittest methods 2.672–2.853 s / 2.213–2.372 s. Every run exited successfully with identical ordered nodeids within its workload. These are local measurements, not a general speedup guarantee.
Measurements compare commit
99ab2acccff15f757260a1e1fbb0d2a47fc01041with this fixture optimization; the branch was subsequently updated to current main. PyTorch was2.12.0a0+0291f960b6.nv26.04.48445190with CPU-only generation.--noconftestwas necessary because that checkout uses a hook argument removed in pytest 9. External plugin autoload and the cache provider were disabled. This does not measure the complete PyTorch CI/plugin environment or execute its test bodies; module imports and dynamic test generation remain major costs.To reproduce the generated workload, use an otherwise empty pytest ini file and run the same command on baseline and patched checkouts:
Use the identical benchmark file in both checkouts and alternate the runs.
Validation
RecursionError.6a0de9be5: fixture, unittest, fixture-display and cache tests — 391 passed, 11 skipped, 3 xfailed; configured pre-commit checks, including ruff and mypy, passed.AI assistance: implementation, tests, and benchmark investigation were prepared with OpenAI Codex, credited in the commit trailer.