Skip to content

Commit 3d95521

Browse files
committed
Fix test coverage gap.
1 parent 456e714 commit 3d95521

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tests/test_mcp.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1558,7 +1558,9 @@ async def test_read_resource_not_found(mcp_server: MCPServerStdio) -> None:
15581558

15591559
async def test_list_resources_error(mcp_server: MCPServerStdio) -> None:
15601560
"""Test that list_resources converts McpError to MCPServerError."""
1561-
mcp_error = McpError(error=ErrorData(code=-32603, message='Failed to list resources'))
1561+
mcp_error = McpError(
1562+
error=ErrorData(code=-32603, message='Failed to list resources', data={'details': 'server overloaded'})
1563+
)
15621564

15631565
async with mcp_server:
15641566
with patch.object(
@@ -1572,6 +1574,10 @@ async def test_list_resources_error(mcp_server: MCPServerStdio) -> None:
15721574
# Verify the exception has the expected attributes
15731575
assert exc_info.value.code == -32603
15741576
assert exc_info.value.message == 'Failed to list resources'
1577+
assert exc_info.value.data == {'details': 'server overloaded'}
1578+
assert (
1579+
str(exc_info.value) == "Failed to list resources (code: -32603, data: {'details': 'server overloaded'})"
1580+
)
15751581

15761582

15771583
async def test_list_resource_templates_error(mcp_server: MCPServerStdio) -> None:

0 commit comments

Comments
 (0)