add conftest
This commit is contained in:
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
15
tests/conftest.py
Normal file
15
tests/conftest.py
Normal file
@@ -0,0 +1,15 @@
|
||||
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)
|
||||
0
tests/integration_tests/__init__.py
Normal file
0
tests/integration_tests/__init__.py
Normal file
0
tests/unit_tests/__init__.py
Normal file
0
tests/unit_tests/__init__.py
Normal file
Reference in New Issue
Block a user