Skip to content

Pytest fixture scope inspection

Pytest fixture scope inspection reports fixtures whose scope is narrower than a fixture they depend on.

How to use it

Open a pytest fixture that depends on another fixture with a broader scope. BetterPy highlights incompatible scope declarations.

When it helps

Use this inspection to catch scope mismatches before pytest fails collection or runtime fixture setup.

Notes

  • BetterPy can offer a quick fix for compatible scope adjustments.
  • The feature is gated by the Pytest fixture scope inspection setting under Settings | BetterPy | Testing (Pytest) | Fixture Inspections.