File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 88from typing import TYPE_CHECKING , Any
99from unittest .util import safe_repr
1010
11+ from asgiref .sync import sync_to_async
1112from django .core .signals import request_started
1213from django .db import (
1314 connection as db_connection ,
@@ -178,6 +179,18 @@ def wrapper_cls(self) -> type[BaseExecutionWrapper]:
178179 return ExplainExecutionWrapper
179180 return BaseExecutionWrapper
180181
182+ async def __aenter__ (self ):
183+ await sync_to_async (self .__enter__ )()
184+ return self
185+
186+ async def __aexit__ (
187+ self ,
188+ exc_type : type [BaseException ] | None ,
189+ exc_value : BaseException | None ,
190+ traceback : TracebackType | None ,
191+ ):
192+ await sync_to_async (self .__exit__ )(exc_type , exc_value , traceback )
193+
181194 def __enter__ (self ) -> Self :
182195 log .debug ('' )
183196
You can’t perform that action at this time.
0 commit comments