from pathlib import Path import aiosqlite import pytest from porchlight.store.sqlite.migrations import run_migrations MIGRATIONS_DIR = ( Path(__file__).resolve().parent.parent.parent / "src" / "porchlight" / "store" / "sqlite" / "migrations" ) @pytest.fixture async def db(): conn = await aiosqlite.connect(":memory:") conn.row_factory = aiosqlite.Row await conn.execute("PRAGMA foreign_keys=ON") await run_migrations(conn, MIGRATIONS_DIR) yield conn await conn.close()