mirror of
https://github.com/MadcowD/ell.git
synced 2024-09-22 16:14:36 +03:00
no openai key required
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user