Skip to content

Commit 7cbfd0f

Browse files
committed
test: gh-106749 heal in StreamingASGITransport.__aexit__
The in-process ASGI bridge (tests/interaction/transports/_bridge.py) cancels its task group on close. After main's #2764-2767 moved the shared SHTTP/SSE/security tests to this transport, this became the remaining unhealed throw site on 3.11. Same checkpoint pattern, applied at the actual cancel site (_bridge.py is a helper, not a snapshot test).
1 parent 40687f0 commit 7cbfd0f

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

tests/interaction/transports/_bridge.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
import anyio
3333
import anyio.abc
34+
import anyio.lowlevel
3435
import httpx
3536
from anyio.streams.memory import MemoryObjectReceiveStream
3637
from starlette.types import ASGIApp, Message, Scope
@@ -88,6 +89,10 @@ async def __aexit__(
8889
if self._cancel_on_close:
8990
self._task_group.cancel_scope.cancel()
9091
await self._task_group.__aexit__(exc_type, exc_value, traceback)
92+
# gh-106749: the cancel above is delivered via coro.throw() on
93+
# CPython 3.11; resume via .send() so coverage's CTracer re-syncs
94+
# for whatever the caller does after this context manager exits.
95+
await anyio.lowlevel.cancel_shielded_checkpoint()
9196

9297
async def handle_async_request(self, request: httpx.Request) -> httpx.Response:
9398
assert isinstance(request.stream, httpx.AsyncByteStream)

0 commit comments

Comments
 (0)