0
0
mirror of https://github.com/django/django.git synced 2024-11-24 20:07:01 +01:00

Adds note about sync-only calls in async decorators.

This commit is contained in:
Matthew Schinckel 2024-02-06 10:55:42 +10:30
parent 3580b47ed3
commit e6867c729a

View File

@ -2087,7 +2087,9 @@ creates.
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
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
methods with :func:`~asgiref.sync.async_to_sync` *inside* of them instead::