diff --git a/tests/conftest.py b/tests/conftest.py index 1e0dbf1b..7b57dafb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,8 +6,8 @@ from sqlalchemy import create_engine, text from sqlalchemy.orm import sessionmaker, scoped_session -from app.models import Base -from app.interface import HarvesterDBInterface +# from app.models import Base +# from app.interface import HarvesterDBInterface from harvester.utils import open_json @@ -16,34 +16,34 @@ HARVEST_SOURCES = Path(__file__).parents[0] / "harvest-sources" -@pytest.fixture(scope="session") -def db_session(): - DATABASE_SERVER = os.getenv("DATABASE_SERVER") - DATABASE_URI = os.getenv("DATABASE_URI") - TEST_SCHEMA = "test_schema" - modified_uri = DATABASE_URI.replace("@" + DATABASE_SERVER, "@localhost") - engine = create_engine(modified_uri) +# @pytest.fixture(scope="session") +# def db_session(): +# DATABASE_SERVER = os.getenv("DATABASE_SERVER") +# DATABASE_URI = os.getenv("DATABASE_URI") +# TEST_SCHEMA = "test_schema" +# modified_uri = DATABASE_URI.replace("@" + DATABASE_SERVER, "@localhost") +# engine = create_engine(modified_uri) - with engine.connect() as connection: - connection.execute(text(f"CREATE SCHEMA IF NOT EXISTS {TEST_SCHEMA};")) - connection.execute(text(f"SET search_path TO {TEST_SCHEMA};")) +# with engine.connect() as connection: +# connection.execute(text(f"CREATE SCHEMA IF NOT EXISTS {TEST_SCHEMA};")) +# connection.execute(text(f"SET search_path TO {TEST_SCHEMA};")) - Base.metadata.create_all(engine) - SessionLocal = sessionmaker(bind=engine) +# Base.metadata.create_all(engine) +# SessionLocal = sessionmaker(bind=engine) - session = scoped_session(SessionLocal) - yield session +# session = scoped_session(SessionLocal) +# yield session - session.remove() - engine.dispose() +# session.remove() +# engine.dispose() - with engine.begin() as connection: - connection.execute(text(f"DROP SCHEMA IF EXISTS {TEST_SCHEMA} CASCADE;")) +# with engine.begin() as connection: +# connection.execute(text(f"DROP SCHEMA IF EXISTS {TEST_SCHEMA} CASCADE;")) -@pytest.fixture(scope="session") -def db_interface(db_session): - return HarvesterDBInterface(db_session) +# @pytest.fixture(scope="session") +# def db_interface(db_session): +# return HarvesterDBInterface(db_session) @pytest.fixture