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): settle the shared logging worker before recording shadow callbacks (#43847)
devin-ai-integration[bot]b370996b9d2f
diff --git a/tests/unit/test_router_silent_experiment.py b/tests/unit/test_router_silent_experiment.pyindex ab65e09e133..722a76fa7ef 100644--- a/tests/unit/test_router_silent_experiment.py+++ b/tests/unit/test_router_silent_experiment.py@@ -9,6 +9,7 @@ import pytestimport litellmfrom litellm.integrations.custom_logger import CustomLogger+from litellm.litellm_core_utils.logging_worker import GLOBAL_LOGGING_WORKERfrom litellm.router import Routerfrom litellm.router import _silent_experiment_kwargs_snapshotfrom litellm.router import _silent_experiment_targets@@ -30,8 +31,20 @@ class _RecordingLogger(CustomLogger):]+async def _settle_shared_logging_worker() -> None:+ try:+ await GLOBAL_LOGGING_WORKER.flush()+ finally:+ await GLOBAL_LOGGING_WORKER.stop()++@pytest.fixturedef recording_logger():+ settle_loop: Final = asyncio.new_event_loop()+ try:+ settle_loop.run_until_complete(_settle_shared_logging_worker())+ finally:+ settle_loop.close()original_callbacks: Final = litellm.callbackslogger: Final = _RecordingLogger()litellm.callbacks = [logger]