Skip to content

Conversation

@Dooopinder
Copy link
Contributor

This PR clarifies fixture visibility vs scope, recommends conftest.py for sharing fixtures, and documents why importing fixtures is discouraged.

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

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Jan 18, 2026
Copy link
Member

@bluetech bluetech left a 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).

@Dooopinder
Copy link
Contributor Author

Thanks a lot for the detailed review! This makes sense — I’ll rework the text

@Dooopinder
Copy link
Contributor Author

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.

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.

Improve documentation around conftest-files and importing of fixtures

2 participants