-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Docs: clarify conftest usage and fixture import pitfalls #14128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Docs: clarify conftest usage and fixture import pitfalls #14128
Conversation
for more information, see https://pre-commit.ci
bluetech
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking at this. Please see my comments.
Also pinging @The-Compiler who might want to review this (the issue discusses a bit larger reworking of the docs around this IIUC).
|
Thanks a lot for the detailed review! This makes sense — I’ll rework the text |
|
Hello @bluetech :) I’ve updated the text to integrate the notes into the main flow, clarified the wording, and addressed the type-annotation explanation. Please let me know if this looks better now. |
Clarifies that fixture scope controls lifetime and caching, not visibility
Explicitly explains that fixture visibility depends on where it is defined (test module, conftest.py, or plugin)
Recommends conftest.py as the correct and supported way to share fixtures across multiple test modules
Adds a clear warning against importing fixtures from test files or conftest.py, which can cause duplicate registration and confusing behavior
Adds a simple rule of thumb: never import fixtures except for type annotations
Links readers to the reference documentation for deeper technical details
closes #13148