[pytest-dev] Fixture ordering and scopes
Floris Bruynooghe
flub at devork.be
Fri Mar 16 04:46:09 EDT 2018
Brian Okken <variedthoughts at gmail.com> writes:
> I get numerous questions about it, and I always tell people to create
> artificial dependencies between fixtures that need to run in a certain
> order.
I'm not sure I follow why you consider them to be *artificial*
dependencies. If a function-scoped fixture depends on anything of a
session-scoped fixture, surely you'd rather have the dependency
explicitly in your face rather then it slipping past by luck?
> The general mental model that people have for fixtures is that they are run
> in scope order.
> I think the current behavior of file order overriding scope order is insane
> and a bug.
My general mental model of fixtures is that they are as lazy as
possible. This is probably also somewhat incorrect.
More information about the pytest-dev
mailing list