mirror of
https://github.com/django/django.git
synced 2025-07-06 02:39:12 +00:00
Adds note about sync-only calls in async decorators.
This commit is contained in:
parent
3580b47ed3
commit
e6867c729a
@ -2087,7 +2087,9 @@ creates.
|
|||||||
If you are using test decorators, they must be async-compatible to ensure
|
If you are using test decorators, they must be async-compatible to ensure
|
||||||
they work correctly. Django's built-in decorators will behave correctly, but
|
they work correctly. Django's built-in decorators will behave correctly, but
|
||||||
third-party ones may appear to not execute (they will "wrap" the wrong part
|
third-party ones may appear to not execute (they will "wrap" the wrong part
|
||||||
of the execution flow and not your test).
|
of the execution flow and not your test). Similarly, decorators that perform
|
||||||
|
synchronous database operations cannot be applied directly to an async test
|
||||||
|
function.
|
||||||
|
|
||||||
If you need to use these decorators, then you should decorate your test
|
If you need to use these decorators, then you should decorate your test
|
||||||
methods with :func:`~asgiref.sync.async_to_sync` *inside* of them instead::
|
methods with :func:`~asgiref.sync.async_to_sync` *inside* of them instead::
|
||||||
|
Loading…
x
Reference in New Issue
Block a user