diff options
| author | Jon Janzen <jon@jonjanzen.com> | 2020-11-07 13:19:20 +0300 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-03-07 08:39:25 +0100 |
| commit | e83a88566a71a2353cebc35992c110be0f8628af (patch) | |
| tree | 466c863fc3bfe6fc9946b5a3f7163c62e58ecbb9 /django/test | |
| parent | 9a07999aef7958c9b5441e368cd90646d0edc5c9 (diff) | |
Fixed #32172 -- Adapted signals to allow async handlers.
co-authored-by: kozzztik <kozzztik@mail.ru>
co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
Diffstat (limited to 'django/test')
| -rw-r--r-- | django/test/client.py | 4 | ||||
| -rw-r--r-- | django/test/signals.py | 2 |
2 files changed, 2 insertions, 4 deletions
diff --git a/django/test/client.py b/django/test/client.py index cf63265faa..6e1dbb5be5 100644 --- a/django/test/client.py +++ b/django/test/client.py @@ -219,9 +219,7 @@ class AsyncClientHandler(BaseHandler): body_file = FakePayload("") request_started.disconnect(close_old_connections) - await sync_to_async(request_started.send, thread_sensitive=False)( - sender=self.__class__, scope=scope - ) + await request_started.asend(sender=self.__class__, scope=scope) request_started.connect(close_old_connections) # Wrap FakePayload body_file to allow large read() in test environment. request = ASGIRequest(scope, LimitedStream(body_file, len(body_file))) diff --git a/django/test/signals.py b/django/test/signals.py index 94a5161e82..c16f4aa5ee 100644 --- a/django/test/signals.py +++ b/django/test/signals.py @@ -183,7 +183,7 @@ def complex_setting_changed(*, enter, setting, **kwargs): # this stacklevel shows the line containing the override_settings call. warnings.warn( f"Overriding setting {setting} can lead to unexpected behavior.", - stacklevel=6, + stacklevel=5, ) |
