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(test): add mock isolation for test_video_content_handler_uses_get_for_openai

Julio Quinteros Pro669169475955
diff --git a/tests/test_litellm/test_video_generation.py b/tests/test_litellm/test_video_generation.py
index 2eb16c65aee..d4150c349f4 100644
--- a/tests/test_litellm/test_video_generation.py
+++ b/tests/test_litellm/test_video_generation.py
@@ -810,17 +810,22 @@ def test_video_content_handler_uses_get_for_openai():
mock_response.content = b"mp4-bytes"
mock_client.get.return_value = mock_response
- result = handler.video_content_handler(
- video_id="video_abc",
- video_content_provider_config=config,
- custom_llm_provider="openai",
- litellm_params=GenericLiteLLMParams(api_base="https://api.openai.com/v1"),
- logging_obj=MagicMock(),
- timeout=5.0,
- api_key="sk-test",
- client=mock_client,
- _is_async=False,
- )
+ # Patch _get_httpx_client to ensure no real HTTP client is created
+ # This prevents test isolation issues where isinstance check might fail
+ with patch('litellm.llms.custom_httpx.llm_http_handler._get_httpx_client') as mock_get_client:
+ mock_get_client.return_value = mock_client
+
+ result = handler.video_content_handler(
+ video_id="video_abc",
+ video_content_provider_config=config,
+ custom_llm_provider="openai",
+ litellm_params=GenericLiteLLMParams(api_base="https://api.openai.com/v1"),
+ logging_obj=MagicMock(),
+ timeout=5.0,
+ api_key="sk-test",
+ client=mock_client,
+ _is_async=False,
+ )
assert result == b"mp4-bytes"
mock_client.get.assert_called_once()