]> git.ipfire.org Git - thirdparty/starlette.git/commitdiff
Close unclosed `MemoryObjectReceiveStream` in `TestClient` (#2693)
authorMoataz Elmasry <motaz_1993@hotmail.com>
Sun, 22 Sep 2024 16:54:30 +0000 (17:54 +0100)
committerGitHub <noreply@github.com>
Sun, 22 Sep 2024 16:54:30 +0000 (18:54 +0200)
starlette/testclient.py

index fcf392e334eaca069f16710267f72a567ed421f1..1a2d101a01af937c01af8db1b4e8e6bf2e2cda58 100644 (file)
@@ -784,7 +784,7 @@ class TestClient(httpx.Client):
                 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 (