Create pytest fixtures from parameters¶
Create pytest fixtures from parameters generates a fixture for an unresolved pytest fixture parameter.
How to use it¶
Place the caret on an unresolved fixture parameter in a test or fixture function, then run BetterPy: Create pytest fixture ....
When it helps¶
Use this quick fix when writing tests top-down and adding fixture parameters before defining the fixtures they refer to.
Notes¶
- BetterPy creates a
@pytest.fixturefunction in the appropriate scope and importspytestwhen needed. - The feature is gated by the Create pytest fixtures from parameters setting under Settings | BetterPy | Testing (Pytest) | Fixtures.