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

Function multi_db

tests/test_query_api.py:317–335  ·  view source on GitHub ↗

Fixture that sets up multiple databases for testing.

()

Source from the content-addressed store, hash-verified

315
316@pytest_asyncio.fixture
317async def multi_db():
318 """Fixture that sets up multiple databases for testing."""
319 from tortoise.context import TortoiseContext
320
321 ctx = TortoiseContext()
322 async with ctx:
323 await ctx.init(
324 config={
325 "connections": {
326 "first": "sqlite://:memory:",
327 "second": "sqlite://:memory:",
328 },
329 "apps": {
330 "models": {"models": [__name__], "default_connection": "first"},
331 },
332 }
333 )
334 await ctx.generate_schemas()
335 yield ctx
336
337
338@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 3

initMethod · 0.95
generate_schemasMethod · 0.95
TortoiseContextClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…