summaryrefslogtreecommitdiff
path: root/tests/asgi
diff options
context:
space:
mode:
authorCarlton Gibson <carlton.gibson@noumenal.es>2022-08-04 09:30:41 +0200
committerCarlton Gibson <carlton@noumenal.es>2022-08-04 10:00:36 +0200
commitf476c8847a0bf1a4e20becfb3dc66f4da0dbf579 (patch)
treee73a5408eba483417658050f6b744f18dd9dd27a /tests/asgi
parentd4db417c8e6935222d198925dd4c5ac1ca737909 (diff)
Refs #33173, Refs #33755 -- Fixed ResourceWarning from unclosed files in ASGI tests.
Diffstat (limited to 'tests/asgi')
-rw-r--r--tests/asgi/tests.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/asgi/tests.py b/tests/asgi/tests.py
index 57300d18fc..4e51c2d9fe 100644
--- a/tests/asgi/tests.py
+++ b/tests/asgi/tests.py
@@ -55,6 +55,8 @@ class ASGITest(SimpleTestCase):
response_body = await communicator.receive_output()
self.assertEqual(response_body["type"], "http.response.body")
self.assertEqual(response_body["body"], b"Hello World!")
+ # Allow response.close() to finish.
+ await communicator.wait()
async def test_file_response(self):
"""
@@ -162,6 +164,8 @@ class ASGITest(SimpleTestCase):
response_body = await communicator.receive_output()
self.assertEqual(response_body["type"], "http.response.body")
self.assertEqual(response_body["body"], b"From Scotland,Wales")
+ # Allow response.close() to finish
+ await communicator.wait()
async def test_post_body(self):
application = get_asgi_application()
@@ -190,6 +194,8 @@ class ASGITest(SimpleTestCase):
response_body = await communicator.receive_output()
self.assertEqual(response_body["type"], "http.response.body")
self.assertEqual(response_body["body"], b"")
+ # Allow response.close() to finish
+ await communicator.wait()
async def test_get_query_string(self):
application = get_asgi_application()
@@ -207,6 +213,8 @@ class ASGITest(SimpleTestCase):
response_body = await communicator.receive_output()
self.assertEqual(response_body["type"], "http.response.body")
self.assertEqual(response_body["body"], b"Hello Andrew!")
+ # Allow response.close() to finish
+ await communicator.wait()
async def test_disconnect(self):
application = get_asgi_application()