From 6d70ad3ba8ead93439fd104f16c4299505f1b89d Mon Sep 17 00:00:00 2001 From: Moataz Elmasry Date: Sun, 22 Sep 2024 17:54:30 +0100 Subject: [PATCH] Close unclosed `MemoryObjectReceiveStream` in `TestClient` (#2693) --- starlette/testclient.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/starlette/testclient.py b/starlette/testclient.py index fcf392e33..1a2d101a0 100644 --- a/starlette/testclient.py +++ b/starlette/testclient.py @@ -784,7 +784,7 @@ async def receive() -> typing.Any: self.task.result() return message - async with self.stream_send: + async with self.stream_send, self.stream_receive: await self.stream_receive.send({"type": "lifespan.shutdown"}) message = await receive() assert message["type"] in (