litellm/tests/mcp_tests
Julio Quinteros Pro e8301829cd Fix flaky MCP streaming test by properly mocking inner aresponses call
The test_streaming_mcp_events_validation test was flaky because:
1. It didn't mock the nested aresponses() call inside the iterator's
   _create_initial_response_iterator(), causing real API calls that fail
   without credentials
2. The iterator silently swallowed exceptions and set phase="finished",
   discarding pre-generated MCP discovery events
3. The _execute_tool_calls mock had wrong signature (missing tool_server_map)

Production fix: MCPEnhancedStreamingIterator no longer sets phase="finished"
on LLM call failure — it falls through to emit MCP discovery events first.

Test fix: Added mock for litellm.responses.main.aresponses returning a fake
async streaming iterator, fixed mock signatures, removed try/except that
masked failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 11:09:24 -03:00
..
test_configs [Release Fix] (#22411) 2026-02-28 09:46:35 -08:00
conftest.py [Perf] Improvements for Async Success Handler (Logging Callbacks) - Approx +130 RPS (#13905) 2025-08-23 13:13:23 -07:00
mcp_server.py test: const 2026-01-19 12:03:26 +09:00
test_aresponses_api_with_mcp.py Fix flaky MCP streaming test by properly mocking inner aresponses call 2026-03-04 11:09:24 -03:00
test_mcp_auth_header_extraction.py Auth Header Fix for MCP Tool Call (#15736) 2025-10-21 13:58:03 -07:00
test_mcp_auth_priority.py [Feat] MCP Oauth2 Fixes - Add support for MCP M2M Oauth2 support (#20788) 2026-02-09 17:35:11 -08:00
test_mcp_chat_completions.py fixing mcp tests 2026-02-12 17:53:40 -08:00
test_mcp_client_unit.py added configurable env for mcp timeouts (#22287) 2026-03-02 13:13:41 -08:00
test_mcp_guardrails.py [MCP Gateway] Litellm mcp pre and during guardrails (#13188) 2025-08-01 20:02:25 -07:00
test_mcp_hooks.py [MCP gateway] add pre and during call hooks init (#13067) 2025-07-29 11:06:58 -07:00
test_mcp_litellm_client.py [MCP Gateway] Litellm mcp client list fail (#13114) 2025-07-30 15:23:19 -07:00
test_mcp_logging.py fix: import LiteLLM_ObjectPermissionTable from _types instead of proxy_server 2026-02-13 14:46:03 -03:00
test_mcp_server.py Litellm stability fix v2 (#22452) 2026-02-28 15:29:45 -08:00
test_oauth2_mcp_config.yaml [UI] M2M OAuth2 UI Flow (#20794) 2026-02-09 19:28:02 -08:00
test_openapi_spec_path_url.py mcp: support http(s) URLs for spec_path in OpenAPI MCP loader (#20753) 2026-02-10 16:00:36 +05:30
test_proxy_mcp_e2e.py Merge pull request #22413 from BerriAI/fix/mcp-contextvar-propagation 2026-02-28 17:19:15 -03:00
test_semantic_tool_filter_e2e.py Skip test_e2e_semantic_filter when OPENAI_API_KEY is not set (#20387) 2026-02-03 22:09:47 -08:00