test(mcp): isolate resource error breaker state

This commit is contained in:
Börje 2026-07-17 23:59:22 +02:00 committed by Teknium
parent f26fb901ea
commit 80209e51db

View file

@ -239,10 +239,14 @@ class TestErrorPathResourceText:
finally:
loop.close()
with mock_patch.dict(mcp_tool._servers, {"test-server": fake_server}), \
mock_patch("tools.mcp_tool._run_on_mcp_loop", side_effect=_fake_run_on_mcp_loop):
fake_session.call_tool = AsyncMock()
yield fake_session, mcp_tool._make_tool_handler("test-server", "my-tool", 30.0)
mcp_tool._reset_server_error("test-server")
try:
with mock_patch.dict(mcp_tool._servers, {"test-server": fake_server}), \
mock_patch("tools.mcp_tool._run_on_mcp_loop", side_effect=_fake_run_on_mcp_loop):
fake_session.call_tool = AsyncMock()
yield fake_session, mcp_tool._make_tool_handler("test-server", "my-tool", 30.0)
finally:
mcp_tool._reset_server_error("test-server")
def test_error_embedded_resource_text_surfaced(self, _handler):
from unittest.mock import AsyncMock