[Fix] Remove flush_cache from llm_translation conftest to prevent connection churn

The old conftest never flushed HTTP client cache. Adding flush_cache() before
every test forces new TCP connections to external APIs, causing transient
connection failures under xdist parallelism. Global state isolation is already
handled by _SCALAR_DEFAULTS reset.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
yuneng-jiang
2026-03-16 00:20:40 -07:00
co-authored by Claude Opus 4.6
parent acfaea9d25
commit f434cdbdce
-6
View File
@@ -93,18 +93,12 @@ def setup_and_teardown(event_loop): # Add event_loop as a dependency
if hasattr(litellm, attr):
setattr(litellm, attr, default_val)
if hasattr(litellm, "in_memory_llm_clients_cache"):
litellm.in_memory_llm_clients_cache.flush_cache()
# Set the event loop from the fixture
asyncio.set_event_loop(event_loop)
yield
# ---- Teardown ----
if hasattr(litellm, "in_memory_llm_clients_cache"):
litellm.in_memory_llm_clients_cache.flush_cache()
for attr, original_value in original_state.items():
if hasattr(litellm, attr):
setattr(litellm, attr, original_value)