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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test(router): give each prompt caching check test a fresh callback registry
mateo-berri5ea4fe620fde
diff --git a/tests/unit/router_utils/pre_call_checks/test_prompt_caching_deployment_check.py b/tests/unit/router_utils/pre_call_checks/test_prompt_caching_deployment_check.pyindex 3a3ed2c45f4..a87b24656f3 100644--- a/tests/unit/router_utils/pre_call_checks/test_prompt_caching_deployment_check.py+++ b/tests/unit/router_utils/pre_call_checks/test_prompt_caching_deployment_check.py@@ -1,7 +1,7 @@import asyncioimport copyimport functools-from typing import cast+from typing import Final, castimport pytest@@ -20,6 +20,23 @@ from litellm.utils import get_prompt_cache_min_tokens, is_prompt_caching_valid_pMODEL_GROUP_ALIAS = "my-claude-group"OPUS_4_6_MIN_TOKENS = 4096+CALLBACK_REGISTRIES: Final = (+ "input_callback",+ "success_callback",+ "failure_callback",+ "_async_success_callback",+ "_async_failure_callback",+ "callbacks",+)++[email protected](autouse=True)+def _fresh_callback_registries(monkeypatch):+ """`litellm.logging_callback_manager` keeps one callback per class, so a+ `PromptCachingDeploymentCheck` or `_SentMessagesCapture` left behind by an+ earlier test would swallow the next test's success events."""+ for registry in CALLBACK_REGISTRIES:+ monkeypatch.setattr(litellm, registry, [])@pytest.fixture