diff --git a/projects/pgai/tests/vectorizer/conftest.py b/projects/pgai/tests/vectorizer/conftest.py index 2ac1f3dc8..23b593535 100644 --- a/projects/pgai/tests/vectorizer/conftest.py +++ b/projects/pgai/tests/vectorizer/conftest.py @@ -60,7 +60,6 @@ def vcr_(): def postgres_container_manager() -> ( Generator[Callable[[bool], PostgresContainer], None, None] ): - load_dotenv() extension_dir = os.path.abspath( os.path.join(os.path.dirname(__file__), "../../../extension/") ) @@ -84,6 +83,7 @@ def get_container(load_openai_key: bool = True) -> PostgresContainer: ) if load_openai_key: + load_dotenv() openai_api_key = os.environ["OPENAI_API_KEY"] container = container.with_env("OPENAI_API_KEY", openai_api_key) diff --git a/projects/pgai/tests/vectorizer/extensions/conftest.py b/projects/pgai/tests/vectorizer/extensions/conftest.py index f6f2a6947..3733575f2 100644 --- a/projects/pgai/tests/vectorizer/extensions/conftest.py +++ b/projects/pgai/tests/vectorizer/extensions/conftest.py @@ -44,12 +44,3 @@ def initialized_engine( with engine.connect() as conn: conn.execute(text("DROP SCHEMA public CASCADE; CREATE SCHEMA public;")) conn.commit() - - -@pytest.fixture(autouse=True) -def set_dummy_openai_key( - monkeypatch: pytest.MonkeyPatch, -) -> Generator[None, None, None]: - """Set a dummy OpenAI API key for testing.""" - monkeypatch.setenv("OPENAI_API_KEY", "dummy_key") - yield