From 3ca534b1c0a66d844385d749d9a3f122ecae583a Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 15 Sep 2026 18:49:29 +0000 Subject: [PATCH] test(mcp): suppress TQ008 on new MCP routing tests Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../mcp_server/test_mcp_server.py | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server.py b/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server.py index 4d60b338c21..398f3b2ea40 100644 --- a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server.py +++ b/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server.py @@ -2165,23 +2165,29 @@ async def test_mcp_routing_stashes_peeked_body_for_auth(): stateless_called.append(1) with ( - patch( + patch( # test-quality-ok: the ASGI handler reads auth from a module-level helper; the suite's only seam "litellm.proxy._experimental.mcp_server.server.extract_mcp_auth_context", new_callable=AsyncMock, return_value=(MagicMock(), None, None, None, None, None), ), - patch( + patch( # test-quality-ok: registry is empty in unit tests; key owns one server "litellm.proxy._experimental.mcp_server.server._get_allowed_mcp_servers", new_callable=AsyncMock, return_value=[MagicMock()], ), - patch( + patch( # test-quality-ok: init flag is a module global; no injection seam "litellm.proxy._experimental.mcp_server.server._SESSION_MANAGERS_INITIALIZED", True, ), - patch.object(session_manager_stateless, "handle_request", side_effect=stateless_handle), - patch.object(session_manager_stateless, "_server_instances", {}), - patch.object(session_manager_stateful, "_server_instances", {}), + patch.object( # test-quality-ok: session managers are module-level singletons; the suite's only seam + session_manager_stateless, "handle_request", side_effect=stateless_handle + ), + patch.object( # test-quality-ok: session managers are module-level singletons; the suite's only seam + session_manager_stateless, "_server_instances", {} + ), + patch.object( # test-quality-ok: session managers are module-level singletons; the suite's only seam + session_manager_stateful, "_server_instances", {} + ), ): await handle_streamable_http_mcp(scope, receive, send) @@ -2223,22 +2229,26 @@ async def test_mcp_routing_batch_body_is_not_stashed_for_auth(): send = AsyncMock() with ( - patch( + patch( # test-quality-ok: the ASGI handler reads auth from a module-level helper; the suite's only seam "litellm.proxy._experimental.mcp_server.server.extract_mcp_auth_context", new_callable=AsyncMock, return_value=(MagicMock(), None, None, None, None, None), ), - patch( + patch( # test-quality-ok: registry is empty in unit tests; key owns one server "litellm.proxy._experimental.mcp_server.server._get_allowed_mcp_servers", new_callable=AsyncMock, return_value=[MagicMock()], ), - patch( + patch( # test-quality-ok: init flag is a module global; no injection seam "litellm.proxy._experimental.mcp_server.server._SESSION_MANAGERS_INITIALIZED", True, ), - patch.object(session_manager_stateless, "handle_request", new=AsyncMock()), - patch.object(session_manager_stateless, "_server_instances", {}), + patch.object( # test-quality-ok: session managers are module-level singletons; the suite's only seam + session_manager_stateless, "handle_request", new=AsyncMock() + ), + patch.object( # test-quality-ok: session managers are module-level singletons; the suite's only seam + session_manager_stateless, "_server_instances", {} + ), ): await handle_streamable_http_mcp(scope, receive, send)