MCPcopy
hub / github.com/tortoise/tortoise-orm / db_module

Function db_module

conftest.py:48–64  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

46
47@pytest_asyncio.fixture(scope="module")
48async 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")

Callers

nothing calls this directly

Calls 1

tortoise_test_contextFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…