mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-08 03:08:45 +00:00
fix(test): flush client cache before test_extra_body_with_fallback
Add client cache flush before setting disable_aiohttp_transport to prevent cache pollution. Previous tests may cache HTTP clients with aiohttp enabled, which bypass respx mocks and cause real API calls to fail. This follows the same pattern as test_openai_env_base which also uses respx. Related to #8425 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
4f751bf815
commit
392fa61ac3
1 changed files with 6 additions and 0 deletions
|
|
@ -427,6 +427,12 @@ async def test_extra_body_with_fallback(
|
|||
original_disable_aiohttp = litellm.disable_aiohttp_transport
|
||||
|
||||
try:
|
||||
# Clear cache to ensure no cached clients from previous tests interfere
|
||||
# This prevents cache pollution where a previous test cached a client with
|
||||
# aiohttp transport, which would bypass respx mocks
|
||||
if hasattr(litellm, "in_memory_llm_clients_cache"):
|
||||
litellm.in_memory_llm_clients_cache.flush_cache()
|
||||
|
||||
# since this uses respx, we need to set use_aiohttp_transport to False
|
||||
litellm.disable_aiohttp_transport = True
|
||||
# Set up test parameters
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue