import pytest
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from backend.modules.database.models import Base

@pytest.fixture(scope="session")
def test_engine():
    engine = create_engine("sqlite:///:memory:")
    Base.metadata.create_all(engine)
    return engine

@pytest.fixture(scope="function")
def db_session(test_engine):
    Session = sessionmaker(bind=test_engine)
    session = Session()
    yield session
    session.close() 