How to organize fixtures when using pytest

Light fixtures tend to be small and reusable. Given that a particular fixture can rely on other fixtures

@pytest.fixture
def Account(db, memcache):
    ...

I would like to organize my lights in modules and import them into a specific test file, for example, like this (for example)

from .fixtures.models import Account

Unfortunately this does not work. Instead, I always need to import all the slave fixtures, for example.

from .fixtures.models import Account, db, memcache

What is the best approach to small-scale small, reusable luminaires and their accessibility at the module level. (conftest works at the package / directory level.)

+5
source share
1 answer

, , ( ), , from .fixtures.models import * ? , .

+1

All Articles