from pytest import fixture

from database.crud import delete_data
from tests import TestingSessionLocal


@fixture(scope="session")
def get_test_db():
    try:
        db = TestingSessionLocal()
        yield db
    finally:
        delete_data(model="Users", data=2222, db=db)
        db.close()