summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2024-08-09 12:48:32 -0400
committernessita <124304+nessita@users.noreply.github.com>2024-08-28 11:44:05 -0300
commitc042fe3a74fb213c93b1052f7de4d99a6e6948e0 (patch)
treeab4a7455b16173ca64646191f4e09a9bdfb35c3c /tests
parent7e6e1c8383dbb1fb543e6d1f0e5ca58fc01494c4 (diff)
Refs #33735 -- Adjusted warning stacklevel in StreamingHttpResponse.__iter__()/__aiter__().
Diffstat (limited to 'tests')
-rw-r--r--tests/handlers/tests.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/handlers/tests.py b/tests/handlers/tests.py
index ffa362abdd..e73fc15195 100644
--- a/tests/handlers/tests.py
+++ b/tests/handlers/tests.py
@@ -258,8 +258,9 @@ class HandlerRequestTests(SimpleTestCase):
"StreamingHttpResponse must consume asynchronous iterators in order to "
"serve them synchronously. Use a synchronous iterator instead."
)
- with self.assertWarnsMessage(Warning, msg):
+ with self.assertWarnsMessage(Warning, msg) as ctx:
self.assertEqual(b"".join(list(response)), b"streaming content")
+ self.assertEqual(ctx.filename, __file__)
class ScriptNameTests(SimpleTestCase):
@@ -350,10 +351,11 @@ class AsyncHandlerRequestTests(SimpleTestCase):
"StreamingHttpResponse must consume synchronous iterators in order to "
"serve them asynchronously. Use an asynchronous iterator instead."
)
- with self.assertWarnsMessage(Warning, msg):
+ with self.assertWarnsMessage(Warning, msg) as ctx:
self.assertEqual(
b"".join([chunk async for chunk in response]), b"streaming content"
)
+ self.assertEqual(ctx.filename, __file__)
async def test_async_streaming(self):
response = await self.async_client.get("/async_streaming/")