[pytest-dev] Fixture ordering and scopes
nicoddemus at gmail.com
Fri Mar 16 07:34:09 EDT 2018
On Fri, Mar 16, 2018 at 7:17 AM Vasily Kuznetsov <kvas.it at gmail.com> wrote:
> I very much agree with Floris that if you need fixture A to run before
> fixture B and otherwise things break, this is called "dependency" and it's
> better if it's explicitly declared.
Definitely, if a fixture requires something that is done by another
fixture, then that dependency should be explicitly defined; but the issue
is more that people expect higher level scoped fixtures to be executed
first, and when you mix autouse fixtures and usefixtures markers, the order
> I can't easily imagine a situation where declaring dependencies would be
> too much work or not desirable for some other reason but maybe it's just my
> imagination not being good enough :).
I wrote an example which demonstrates this in a separate reply to Floris.
Outer scopes running before inner scopes does sound kind of logical but
> everything running lazily on demand (as it does now) also makes sense.
Just to be clear, in my PR fixtures are still created lazily, it is just
that we sort them by scope (preserving order) first.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the pytest-dev