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]

[Fix] Restore unconditional importlib.reload for llm_translation conftest

yuneng-jiangccfe4b57d596
diff --git a/tests/llm_translation/conftest.py b/tests/llm_translation/conftest.py
index 8388e7bb107..113c91f9c26 100644
--- a/tests/llm_translation/conftest.py
+++ b/tests/llm_translation/conftest.py
@@ -71,27 +71,9 @@ def setup_and_teardown(event_loop): # Add event_loop as a dependency
original_state[attr] = getattr(litellm, attr)
# ---- Reset to true defaults before the test ----
- worker_id = os.environ.get("PYTEST_XDIST_WORKER", None)
- if worker_id is None:
- # Single-process mode: reload for full reset
- from litellm.litellm_core_utils.logging_worker import GLOBAL_LOGGING_WORKER
- asyncio.run(GLOBAL_LOGGING_WORKER.clear_queue())
- importlib.reload(litellm)
- else:
- # xdist mode: reset globals without reload
- for attr in (
- "callbacks",
- "success_callback",
- "failure_callback",
- "_async_success_callback",
- "_async_failure_callback",
- ):
- if hasattr(litellm, attr):
- setattr(litellm, attr, [])
-
- for attr, default_val in _SCALAR_DEFAULTS.items():
- if hasattr(litellm, attr):
- setattr(litellm, attr, default_val)
+ from litellm.litellm_core_utils.logging_worker import GLOBAL_LOGGING_WORKER
+ asyncio.run(GLOBAL_LOGGING_WORKER.clear_queue())
+ importlib.reload(litellm)
# Set the event loop from the fixture
asyncio.set_event_loop(event_loop)