Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

test: restore model cost map via monkeypatch

mateo-berri54b57575d716
diff --git a/tests/test_litellm/test_gemini_tts_native_audio_pricing.py b/tests/test_litellm/test_gemini_tts_native_audio_pricing.py
index 3679c73aecd..28fc248d5b2 100644
--- a/tests/test_litellm/test_gemini_tts_native_audio_pricing.py
+++ b/tests/test_litellm/test_gemini_tts_native_audio_pricing.py
@@ -74,15 +74,11 @@ def _load(path: Path) -> dict[str, dict[str, object]]:
@pytest.fixture
def local_model_cost_map(monkeypatch: pytest.MonkeyPatch) -> Iterator[None]:
- original_model_cost = litellm.model_cost
monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True")
- litellm.model_cost = litellm.get_model_cost_map(url="")
+ monkeypatch.setattr(litellm, "model_cost", litellm.get_model_cost_map(url=""))
+ litellm.get_model_info.cache_clear()
+ yield
litellm.get_model_info.cache_clear()
- try:
- yield
- finally:
- litellm.model_cost = original_model_cost
- litellm.get_model_info.cache_clear()
@pytest.mark.parametrize("model", ALL_KEYS)