Skip to content

Commit ef06a2d

Browse files
fix no-return assertion
1 parent 771f60e commit ef06a2d

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

tests/integrations/fastmcp/test_fastmcp.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ async def __call__(self, *args, **kwargs):
7171
GetPromptRequest = None
7272
ReadResourceRequest = None
7373

74+
try:
75+
from fastmcp import __version__ as FASTMCP_VERSION
76+
except ImportError:
77+
FASTMCP_VERSION = None
7478

7579
# Collect available FastMCP implementations for parametrization
7680
fastmcp_implementations = []
@@ -1163,7 +1167,14 @@ def none_return_tool(action: str) -> None:
11631167
},
11641168
)
11651169

1166-
assert len(result.message.root.result["content"]) == 0
1170+
if (
1171+
isinstance(mcp, StandaloneFastMCP) and FASTMCP_VERSION is not None
1172+
) or isinstance(mcp, MCPFastMCP):
1173+
assert len(result.message.root.result["content"]) == 0
1174+
else:
1175+
assert result.message.root.result["content"] == [
1176+
{"type": "text", "text": "None"}
1177+
]
11671178

11681179
(tx,) = events
11691180
assert tx["type"] == "transaction"

0 commit comments

Comments
 (0)