Pytest Higher-scope instance fixtures¶
Reports deprecated module, package and session fixtures defined as instance methods.
This inspection applies only when the file's interpreter uses pytest 9.2 or later. Older interpreters and unresolved pytest versions do not receive these warnings. The feature can be toggled independently under Settings → BetterPy → Testing / Pytest → Fixture Inspections.
Move a higher-scope fixture out of the class, or choose a scope appropriate to its instance lifetime. Function- and class-scoped fixtures are unaffected. Dynamic scopes are left to pytest; literal scopes and pytest.Scope members are checked. Static and class methods are not instance methods.