Pytest fixture to usefixtures inspection¶
Pytest fixture to usefixtures inspection reports unused setup-only fixture parameters in tests and offers conversion to @pytest.mark.usefixtures(...).
How to use it¶
Open a test function that declares a setup-only fixture parameter and never references it in the test body. @pytest.mark.usefixtures(...) is the right replacement only when the fixture does not return or yield a value. Fixtures that provide a value stay as parameters so the unused result remains visible.
When it helps¶
Use this inspection to make setup-only fixture dependencies explicit without keeping unused parameters in the test signature.
Notes¶
- BetterPy updates decorators and imports
pytestwhen needed. - Pytest built-in fixtures such as
capsys,tmp_path,monkeypatch, orpytesterare never reported. - The feature is gated by the Pytest fixture to usefixtures inspection setting under Settings | BetterPy | Testing (Pytest) | Fixture Inspections.