Fixture that sets up multiple databases for testing.
()
| 315 | |
| 316 | @pytest_asyncio.fixture |
| 317 | async 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 |
nothing calls this directly
no test coverage detected
searching dependent graphs…