16 lines
508 B
Python
16 lines
508 B
Python
import pytest
|
|
from sqlalchemy import NullPool
|
|
from sqlalchemy.ext.asyncio import create_async_engine
|
|
|
|
from src.core.database import Base
|
|
from src.models import * # noqa: F403
|
|
|
|
engine_null_pool = create_async_engine('sqlite+aiosqlite:///tests/test_db.db', poolclass=NullPool)
|
|
|
|
|
|
@pytest.fixture(scope="session", autouse=True)
|
|
async def setup_database():
|
|
async with engine_null_pool.begin() as conn:
|
|
await conn.run_sync(Base.metadata.drop_all)
|
|
await conn.run_sync(Base.metadata.create_all)
|