From e0ce06e358d8e493846d4fb2d7465fbf6995c9c2 Mon Sep 17 00:00:00 2001 From: elphamale Date: Tue, 11 Aug 2026 09:39:31 +0300 Subject: [PATCH] fix(test): drive MCP identity-header tests through sdk_httpx(), not httpx directly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mcp 2.0 moved the SDK's HTTP stack to httpx2, so patching httpx.AsyncClient no longer intercepts the client Hermes builds for the SDK — the exact pattern test_mcp_client_cert.py already documents and works around. This file predates that awareness; 3 of its 13 tests were silently asserting on an unpatched client and failing under the real mcp==2.0.0 install this branch pins. --- tests/tools/test_mcp_identity_header.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/tools/test_mcp_identity_header.py b/tests/tools/test_mcp_identity_header.py index ac197ad59a..71f15f5953 100644 --- a/tests/tools/test_mcp_identity_header.py +++ b/tests/tools/test_mcp_identity_header.py @@ -138,7 +138,7 @@ def _drive_http(server, config): kwargs passed to ``httpx.AsyncClient``. Mirrors the pattern in ``test_mcp_client_cert.py``. """ - from tools.mcp_tool import MCPServerTask + from tools.mcp_tool import MCPServerTask, sdk_httpx captured: dict = {} @@ -178,7 +178,7 @@ def _drive_http(server, config): async def _drive(): with patch("tools.mcp_tool._MCP_HTTP_AVAILABLE", True), \ patch("tools.mcp_tool._MCP_NEW_HTTP", True), \ - patch("httpx.AsyncClient", DummyAsyncClient), \ + patch.object(sdk_httpx(), "AsyncClient", DummyAsyncClient), \ patch("tools.mcp_tool.streamable_http_client", return_value=DummyTransportCtx()), \ patch("tools.mcp_tool.ClientSession", DummySession), \