mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-06 08:16:43 +00:00
Fix: mock test tests
This commit is contained in:
parent
83e33944ef
commit
8c454eb74f
1 changed files with 1 additions and 30 deletions
|
|
@ -8,7 +8,7 @@ and following LiteLLM testing patterns and best practices.
|
|||
# Standard library imports
|
||||
import os
|
||||
import sys
|
||||
from typing import Dict
|
||||
from typing import Dict, Any
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
# Add parent directory to path for imports
|
||||
|
|
@ -43,35 +43,6 @@ from litellm.proxy.guardrails.init_guardrails import init_guardrails_v2
|
|||
# ============================================================================
|
||||
|
||||
|
||||
@pytest.fixture(scope="function", autouse=True)
|
||||
def setup_and_teardown():
|
||||
"""
|
||||
Standard LiteLLM fixture that reloads litellm before every function
|
||||
to speed up testing by removing callbacks being chained.
|
||||
"""
|
||||
import asyncio
|
||||
import sys
|
||||
|
||||
# Only reload if litellm is already in sys.modules
|
||||
if "litellm" in sys.modules:
|
||||
import importlib
|
||||
importlib.reload(litellm)
|
||||
|
||||
# Set up async loop
|
||||
loop = asyncio.get_event_loop_policy().new_event_loop()
|
||||
asyncio.set_event_loop(loop)
|
||||
|
||||
# Set up litellm state
|
||||
litellm.set_verbose = True
|
||||
litellm.guardrail_name_config_map = {}
|
||||
|
||||
yield
|
||||
|
||||
# Teardown
|
||||
loop.close()
|
||||
asyncio.set_event_loop(None)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def env_setup(monkeypatch):
|
||||
"""Fixture to set up environment variables for testing."""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue