mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-16 02:12:01 +00:00
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>