New pytest members¶
New pytest members adds Generate menu actions for creating pytest tests and fixtures in the current scope.
How to use it¶
Open a module or class matching the configured pytest collection naming, then run Generate | pytest test or Generate | pytest fixture.
When it helps¶
Use these actions when adding tests or fixtures near the caret without manually typing boilerplate or decorators.
Notes¶
- New test names and fixture names are generated uniquely for the current file or class.
- Fixture generation imports
pytestwhen needed. - Test and fixture generation are hidden when neither the current module nor the containing class matches the configured pytest collection naming.
- Test generation is hidden in
conftest.py, while fixture generation remains available there. - The feature is gated by the New pytest members setting under Settings | BetterPy | Testing (Pytest) | Fixtures.