Skip to content

Commit 49cbc29

Browse files
committed
adding sleep to avoid deadlock
1 parent dca806b commit 49cbc29

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/shared/test_streamable_http.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1140,6 +1140,8 @@ async def run_tool():
11401140
metadata = ClientMessageMetadata(
11411141
resumption_token=captured_resumption_token,
11421142
)
1143+
# We need to wait for the tool to send another message so this doesn't deadlock. Fixing is out of scope for this PR. More details in https://github.com/modelcontextprotocol/python-sdk/issues/860
1144+
await anyio.sleep(0.2)
11431145
result = await session.send_request(
11441146
types.ClientRequest(
11451147
types.CallToolRequest(
@@ -1153,13 +1155,14 @@ async def run_tool():
11531155
metadata=metadata,
11541156
)
11551157

1158+
11561159
# We should get a complete result
11571160
assert len(result.content) == 1
11581161
assert result.content[0].type == "text"
11591162
assert "Completed" in result.content[0].text
11601163

11611164
# We should have received the remaining notifications
1162-
assert len(captured_notifications) > 0
1165+
assert len(captured_notifications) == 2
11631166

11641167
# Should not have the first notification
11651168
# Check that "Tool started" notification isn't repeated when resuming

0 commit comments

Comments
 (0)