@@ -55,6 +55,8 @@ async def test_get_asgi_application(self):
55
55
response_body = await communicator .receive_output ()
56
56
self .assertEqual (response_body ["type" ], "http.response.body" )
57
57
self .assertEqual (response_body ["body" ], b"Hello World!" )
58
+ # Allow response.close() to finish.
59
+ await communicator .wait ()
58
60
59
61
async def test_file_response (self ):
60
62
"""
@@ -162,6 +164,8 @@ async def test_headers(self):
162
164
response_body = await communicator .receive_output ()
163
165
self .assertEqual (response_body ["type" ], "http.response.body" )
164
166
self .assertEqual (response_body ["body" ], b"From Scotland,Wales" )
167
+ # Allow response.close() to finish
168
+ await communicator .wait ()
165
169
166
170
async def test_post_body (self ):
167
171
application = get_asgi_application ()
@@ -190,6 +194,8 @@ async def test_untouched_request_body_gets_closed(self):
190
194
response_body = await communicator .receive_output ()
191
195
self .assertEqual (response_body ["type" ], "http.response.body" )
192
196
self .assertEqual (response_body ["body" ], b"" )
197
+ # Allow response.close() to finish
198
+ await communicator .wait ()
193
199
194
200
async def test_get_query_string (self ):
195
201
application = get_asgi_application ()
@@ -207,6 +213,8 @@ async def test_get_query_string(self):
207
213
response_body = await communicator .receive_output ()
208
214
self .assertEqual (response_body ["type" ], "http.response.body" )
209
215
self .assertEqual (response_body ["body" ], b"Hello Andrew!" )
216
+ # Allow response.close() to finish
217
+ await communicator .wait ()
210
218
211
219
async def test_disconnect (self ):
212
220
application = get_asgi_application ()
0 commit comments