[pytest-dev] Fixture ordering and scopes

Bruno Oliveira nicoddemus at gmail.com
Tue Mar 20 07:02:22 EDT 2018


On Sat, Mar 17, 2018 at 6:38 PM Floris Bruynooghe <flub at devork.be> wrote:

>
> I'm still not following this, I'm probably being silly.  You have 4
> autouse session-scoped fixtures but with a dependecy chain as
> my_db_setup -> my_setup_logging -> setup_logging and then an unrelated
> db_setup.  What am I missing here?
>

Oh my bad, db_setup should be a dependency of my_db_setup:

@pytest.fixture(scope='session', autouse=True)
def my_setup_logging(log_setup): pass

@pytest.fixture(scope='session', autouse=True)
def my_db_setup(my_setup_logging, db_setup): pass

Sorry for the mistake!

Cheers,
Bruno.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20180320/56c42b11/attachment.html>


More information about the pytest-dev mailing list