import asyncio

import pytest
from sqlalchemy.ext.asyncio import create_async_engine
from sqlalchemy.ext.asyncio.engine import AsyncConnection
from sqlmodel.ext.asyncio.session import AsyncSession

from basesqlmodel import Base

engine = create_async_engine("sqlite+aiosqlite:///:memory:")


@pytest.fixture()
async def connection() -> AsyncConnection:
    async with engine.begin() as conn:
        yield conn
        await conn.rollback()


@pytest.fixture()
async def session(connection: AsyncConnection):
    async with 