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

Function db_module_postgres

tests/contrib/postgres/conftest.py:24–39  ·  view source on GitHub ↗

Module-scoped fixture for postgres tests using standard testmodels. Creates a TortoiseContext with tests.testmodels once per test module. Used as base for postgres tests that need standard models like TextFields.

()

Source from the content-addressed store, hash-verified

22
23@pytest_asyncio.fixture(scope="module")
24async def db_module_postgres():
25 """
26 Module-scoped fixture for postgres tests using standard testmodels.
27
28 Creates a TortoiseContext with tests.testmodels once per test module.
29 Used as base for postgres tests that need standard models like TextFields.
30 """
31 skip_if_not_postgres()
32 db_url = os.getenv("TORTOISE_TEST_DB", "sqlite://:memory:")
33 async with tortoise_test_context(
34 modules=["tests.testmodels"],
35 db_url=db_url,
36 app_label="models",
37 connection_label="models",
38 ) as ctx:
39 yield ctx
40
41
42@pytest_asyncio.fixture(scope="function")

Callers

nothing calls this directly

Calls 2

tortoise_test_contextFunction · 0.90
skip_if_not_postgresFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…