(obj, recurse=True)
| 371 | |
| 372 | |
| 373 | def _apply_maybe_async(obj, recurse=True): |
| 374 | from sqlalchemy.testing import asyncio |
| 375 | |
| 376 | for name, value in vars(obj).items(): |
| 377 | if ( |
| 378 | (callable(value) or isinstance(value, classmethod)) |
| 379 | and not getattr(value, "_maybe_async_applied", False) |
| 380 | and (name.startswith("test_")) |
| 381 | and not _is_wrapped_coroutine_function(value) |
| 382 | ): |
| 383 | is_classmethod = False |
| 384 | if isinstance(value, classmethod): |
| 385 | value = value.__func__ |
| 386 | is_classmethod = True |
| 387 | |
| 388 | @_pytest_fn_decorator |
| 389 | def make_async(fn, *args, **kwargs): |
| 390 | return asyncio._maybe_async(fn, *args, **kwargs) |
| 391 | |
| 392 | do_async = make_async(value) |
| 393 | if is_classmethod: |
| 394 | do_async = classmethod(do_async) |
| 395 | do_async._maybe_async_applied = True |
| 396 | |
| 397 | setattr(obj, name, do_async) |
| 398 | if recurse: |
| 399 | for cls in obj.mro()[1:]: |
| 400 | if cls != object: |
| 401 | _apply_maybe_async(cls, False) |
| 402 | return obj |
| 403 | |
| 404 | |
| 405 | def _parametrize_cls(module, cls): |
no test coverage detected