Skip to content

Commit 1a4fc3a

Browse files
committed
test: gh-106749 heal at test_streamable_http resumption-test cancel site
The test cancels a task group mid-body (line 1381) to kill the first client session while a tool is blocked; that cancel is the throw, and the second session's lines (1399-1404) fall in the desynced window. Same checkpoint pattern, applied at the actual site (the autouse fixture is a cross-test backstop and cannot help an intra-test desync).
1 parent 6ffc8c8 commit 1a4fc3a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tests/shared/test_streamable_http.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from urllib.parse import urlparse
1919

2020
import anyio
21+
import anyio.lowlevel
2122
import httpx
2223
import pytest
2324
import requests
@@ -1379,6 +1380,11 @@ async def run_tool():
13791380
# Kill the client session while tool is waiting on lock
13801381
tg.cancel_scope.cancel()
13811382

1383+
# gh-106749 heal: the cancel above is delivered via coro.throw() on
1384+
# CPython 3.11; resume via .send() so coverage's CTracer re-syncs before
1385+
# the second session's lines.
1386+
await anyio.lowlevel.cancel_shielded_checkpoint()
1387+
13821388
async with create_mcp_http_client(headers=headers) as httpx_client2:
13831389
async with streamable_http_client(f"{server_url}/mcp", http_client=httpx_client2) as (
13841390
read_stream,

0 commit comments

Comments
 (0)