dropshop / tests /conftest.py
github-actions[bot]
Automated deployment from GitHub Actions: a9d5a91de63ad7224bafe6039fb2b7479388fbf4
0a8c81b
Raw History Blame Contribute Delete
823 Bytes
import pytest
from sqlmodel import SQLModel, create_engine, Session
from src.models.database import get_session
# Create a SQLite in-memory database for testing
sqlite_url = "sqlite:///:memory:"
engine = create_engine(sqlite_url, connect_args={"check_same_thread": False})
@pytest.fixture(name="session")
def session_fixture():
SQLModel.metadata.create_all(engine)
with Session(engine) as session:
yield session
SQLModel.metadata.drop_all(engine)
@pytest.fixture(autouse=True)
def override_get_session(session):
def get_session_override():
yield session
# In src/agents/fulfiller_agent.py, get_session is imported directly.
# To properly mock it, we should patch the specific module where it's used.
# We will do this within the test files using unittest.mock.patch
pass