From cb8d7ca0ba0adc4fcefc069eae26f842a15755a1 Mon Sep 17 00:00:00 2001 From: Piotr Kunicki Date: Thu, 14 Oct 2021 14:44:35 +0200 Subject: [PATCH] Refs #30509 -- Adjusted FileResponse test to close file earlier. --- tests/responses/test_fileresponse.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/responses/test_fileresponse.py b/tests/responses/test_fileresponse.py index 85350cd9f1..4e10105ce5 100644 --- a/tests/responses/test_fileresponse.py +++ b/tests/responses/test_fileresponse.py @@ -188,8 +188,9 @@ class FileResponseTests(SimpleTestCase): pipe_for_write.write(b'binary content') response = FileResponse(os.fdopen(pipe_for_read, mode='rb')) - self.assertEqual(list(response), [b'binary content']) + response_content = list(response) response.close() + self.assertEqual(response_content, [b'binary content']) self.assertFalse(response.has_header('Content-Length')) def test_compressed_response(self):