From a5bc0cfd35c50d3446215c0674e60786d9e498d1 Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Sat, 23 Nov 2024 16:43:38 -0500 Subject: [PATCH] Refs #33735 -- Captured stderr during ASGITest.test_file_response. --- tests/asgi/tests.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/asgi/tests.py b/tests/asgi/tests.py index 658e9d853e..66ec4369d9 100644 --- a/tests/asgi/tests.py +++ b/tests/asgi/tests.py @@ -21,6 +21,7 @@ from django.test import ( modify_settings, override_settings, ) +from django.test.utils import captured_stderr from django.urls import path from django.utils.http import http_date from django.views.decorators.csrf import csrf_exempt @@ -95,7 +96,8 @@ class ASGITest(SimpleTestCase): with open(test_filename, "rb") as test_file: test_file_contents = test_file.read() # Read the response. - response_start = await communicator.receive_output() + with captured_stderr(): + response_start = await communicator.receive_output() self.assertEqual(response_start["type"], "http.response.start") self.assertEqual(response_start["status"], 200) headers = response_start["headers"]