From c1035a0fae284797d2b74a2f0b922a24242e4301 Mon Sep 17 00:00:00 2001 From: "Ivan Mladjenovic (He/Him)" Date: Thu, 12 Dec 2024 17:20:53 +0000 Subject: [PATCH] attempt to fix all tests by mocking openai in conftest --- backend/conftest.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/conftest.py b/backend/conftest.py index f7d5bd43..2de79028 100644 --- a/backend/conftest.py +++ b/backend/conftest.py @@ -14,13 +14,14 @@ def pytest_configure(config): @pytest.fixture(autouse=True) +@patch("src.llm.OpenAI.client") # Ensure this matches the import path in your module def mock_async_openai(): print("======================++++++++++++++++Patching AsyncOpenAI") logger.info("======================++++++++++++++++Patching AsyncOpenAI") - with patch("openai.AsyncOpenAI") as mock_async_openai: - yield mock_async_openai with patch("src.llm.openai.OpenAI") as mock_async_openai: yield mock_async_openai + with patch("openai.AsyncOpenAI") as mock_async_openai: + yield mock_async_openai with patch("src.llm.openai.OpenAI.client") as mock_async_openai: yield mock_async_openai print("AsyncOpenAI patched")