In the latest release of pytest, it is easy to create fixtures that are function, class, module or session-scoped like this:
@pytest.fixture(scope="module")
def db():
return DB()
That creates a fixture that is going to be called only once for each python module in which it is used.
But what about fixtures that need to be called once per python package ?
(With nose, it can be done using setUp/tearDown methods in the __init__.py of the package)