fix(mcp): update test mocks for renamed filter_server_ids_by_ip_with_info#22327
fix(mcp): update test mocks for renamed filter_server_ids_by_ip_with_info#22327
Conversation
…th_info Tests were mocking the old method name `filter_server_ids_by_ip` but production code at server.py:774 calls `filter_server_ids_by_ip_with_info` which returns a (server_ids, blocked_count) tuple. The unmocked method on AsyncMock returned a coroutine, causing "cannot unpack non-iterable coroutine object" errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR fixes 3 failing MCP tests by updating mock definitions to match a renamed production method. The method
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| tests/mcp_tests/test_mcp_server.py | Updates 11 mock definitions from old method name filter_server_ids_by_ip to renamed filter_server_ids_by_ip_with_info, with correct (server_ids, 0) tuple return value matching production code signature. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Test calls production code<br/>(server.py:777)"] --> B["global_mcp_server_manager<br/>.filter_server_ids_by_ip_with_info()"]
B --> C{"Mock present?"}
C -->|"Before fix: mocked as<br/>filter_server_ids_by_ip"| D["❌ Unmocked AsyncMock<br/>returns coroutine"]
D --> E["TypeError: cannot unpack<br/>non-iterable coroutine object"]
C -->|"After fix: mocked as<br/>filter_server_ids_by_ip_with_info"| F["✅ Returns (server_ids, 0)<br/>tuple as expected"]
F --> G["Production code unpacks:<br/>ids, blocked = result"]
G --> H["Test passes ✅"]
Last reviewed commit: cb4cfa1
|
The Ruff PLR0915 lint failures are not related to this PR. They are pre-existing on main. Fix PR: #22328 |
|
The e2e test failure ( |
|
The |
|
The realtime streaming guardrail test failures ( |
CI Failure: Anthropic pass-through test + Bedrock parallel_tool_callsBoth failures are pre-existing on main and unrelated to this PR's MCP test mock changes. 1. Bedrock
|
|
@shin-bot-litellm evaluate this PR |
Summary
test_mcp_server.pywere mocking the old method namefilter_server_ids_by_ipbut production code (server.py:774) callsfilter_server_ids_by_ip_with_infowhich returns a(server_ids, blocked_count)tupleAsyncMockreturned a coroutine instead of a tuple, causingTypeError: cannot unpack non-iterable coroutine objectandValueError: not enough values to unpack(server_ids, 0)tupleFixes 3 failing tests on main:
test_get_tools_from_mcp_serverstest_filter_tools_by_disallowed_tools_integrationtest_filter_tools_by_allowed_tools_integrationTest plan
🤖 Generated with Claude Code