| 48 | pass |
| 49 | |
| 50 | def addAsyncCleanup(self, func, /, *args, **kwargs): |
| 51 | # A trivial trampoline to addCleanup() |
| 52 | # the function exists because it has a different semantics |
| 53 | # and signature: |
| 54 | # addCleanup() accepts regular functions |
| 55 | # but addAsyncCleanup() accepts coroutines |
| 56 | # |
| 57 | # We intentionally don't add inspect.iscoroutinefunction() check |
| 58 | # for func argument because there is no way |
| 59 | # to check for async function reliably: |
| 60 | # 1. It can be "async def func()" itself |
| 61 | # 2. Class can implement "async def __call__()" method |
| 62 | # 3. Regular "def func()" that returns awaitable object |
| 63 | self.addCleanup(*(func, *args), **kwargs) |
| 64 | |
| 65 | async def enterAsyncContext(self, cm): |
| 66 | """Enters the supplied asynchronous context manager. |