In the latest version of pytest, it's easy to create devices that are functions, classes, modules, or sessions, such as:
@pytest.fixture(scope="module") def db(): return DB()
This creates a device that will only be called once for each python module in which it is used.
But what about fixtures that need to be called once per python package? (With the nose, this can be done using the setUp / tearDown methods in the __init__.py package)
benselme
source share