generated from coulomb/repo-seed
23 lines
542 B
Python
23 lines
542 B
Python
import pytest
|
|
from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine
|
|
|
|
import core_hub.models # noqa: F401
|
|
from core_hub.app import create_app
|
|
from core_hub.db import Base
|
|
|
|
|
|
@pytest.fixture
|
|
def app():
|
|
return create_app()
|
|
|
|
|
|
@pytest.fixture
|
|
async def sqlite_engine() -> AsyncEngine:
|
|
engine = create_async_engine("sqlite+aiosqlite:///:memory:")
|
|
async with engine.begin() as connection:
|
|
await connection.run_sync(Base.metadata.create_all)
|
|
try:
|
|
yield engine
|
|
finally:
|
|
await engine.dispose()
|