Skip to content

Commit

Permalink
attempt to fix all tests by mocking openai in conftest
Browse files Browse the repository at this point in the history
  • Loading branch information
IMladjenovic committed Dec 12, 2024
1 parent 607f7df commit c1035a0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backend/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit c1035a0

Please sign in to comment.