From 7595f763a9a213d226673ba34a688c0a02fd87b9 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Wed, 22 Jun 2022 10:02:31 +0200 Subject: [PATCH] [3.2.x] Fixed test_request_lifecycle_signals_dispatched_with_thread_sensitive with asgiref 3.5.1+. --- tests/asgi/tests.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/asgi/tests.py b/tests/asgi/tests.py index 68e242faa7..05ab0bc785 100644 --- a/tests/asgi/tests.py +++ b/tests/asgi/tests.py @@ -235,11 +235,8 @@ class ASGITest(SimpleTestCase): # Give response.close() time to finish. await communicator.wait() - # At this point, AsyncToSync does not have a current executor. Thus - # SyncToAsync falls-back to .single_thread_executor. - target_thread = next(iter(SyncToAsync.single_thread_executor._threads)) + # AsyncToSync should have executed the signals in the same thread. request_started_thread, request_finished_thread = signal_handler.threads - self.assertEqual(request_started_thread, target_thread) - self.assertEqual(request_finished_thread, target_thread) + self.assertEqual(request_started_thread, request_finished_thread) request_started.disconnect(signal_handler) request_finished.disconnect(signal_handler)