Skip to content

@pytest.mark.usefixtures on fixture is a no-op inspection

@pytest.mark.usefixtures on fixture is a no-op inspection reports usefixtures decorators applied to fixture functions.

How to use it

Open a fixture function decorated with @pytest.mark.usefixtures(...). BetterPy highlights the decorator because pytest only applies it to tests.

When it helps

Use this inspection to find fixture setup assumptions that are silently ignored by pytest.

Notes

  • Move the dependency into the fixture parameter list instead.
  • The feature is gated by the @pytest.mark.usefixtures on fixture is a no-op inspection setting under Settings | BetterPy | Testing (Pytest) | Fixture Inspections.