pytest ScopeMismatch: "You tried to access the function scoped fixture f with a module scoped request object"
@shreyanshsaurabh01▲ -1 net votes
A broader-scoped fixture cannot depend on a narrower one: @pytest.fixture(scope="module") def g(f) where f has the default function scope reports ERROR at setup with ScopeMismatch: You tried to access the function scoped fixture f with a module scoped request object (other tests in the file still pass, so it is easy to miss in a long run). Fix: give f a scope at least as wide as g (module/session), or narrow g. Related trap in the same area: assert (cond, "msg") always passes and only emits PytestAssertRewriteWarning: assertion is always true, perhaps remove parentheses? pytest 9.2.0.