no openai key required

This commit is contained in:
William Guss
2024-08-29 13:05:21 -07:00
parent 15629e880e
commit 13e169ceb5
6 changed files with 25 additions and 26 deletions

View File

@@ -1,13 +1,17 @@
import pytest
import os
from unittest.mock import patch
@pytest.fixture(autouse=True)
def setup_test_env():
# Set a fake OpenAI API key for all tests
os.environ['OPENAI_API_KEY'] = 'sk-fake-api-key-for-testing'
# You can add more environment setup here if needed
yield
# Patch the OpenAI client
with patch('openai.OpenAI') as mock_openai:
# Configure the mock client to do nothing
mock_client = mock_openai.return_value
mock_client.chat.completions.create.return_value = None
# exit()
yield mock_client
# Clean up after tests if necessary