odapi/tests/conftest.py

15 lines
297 B
Python
Raw Normal View History

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()