Module-scoped fixture: Creates TortoiseContext once per test module. This is the base fixture that creates the database schema once per module. Other fixtures build on top of this for different isolation strategies. Note: Uses connection_label="models" to match standard test infra
()
| 46 | |
| 47 | @pytest_asyncio.fixture(scope="module") |
| 48 | async def db_module(): |
| 49 | """ |
| 50 | Module-scoped fixture: Creates TortoiseContext once per test module. |
| 51 | |
| 52 | This is the base fixture that creates the database schema once per module. |
| 53 | Other fixtures build on top of this for different isolation strategies. |
| 54 | |
| 55 | Note: Uses connection_label="models" to match standard test infrastructure. |
| 56 | """ |
| 57 | db_url = os.getenv("TORTOISE_TEST_DB", "sqlite://:memory:") |
| 58 | async with tortoise_test_context( |
| 59 | modules=["tests.testmodels"], |
| 60 | db_url=db_url, |
| 61 | app_label="models", |
| 62 | connection_label="models", |
| 63 | ) as ctx: |
| 64 | yield ctx |
| 65 | |
| 66 | |
| 67 | @pytest_asyncio.fixture(scope="function") |
nothing calls this directly
no test coverage detected
searching dependent graphs…