gh-128404: Run TestGetAsyncGenState without asyncio - #156808
Conversation
inspect.getasyncgenstate() and getasyncgenlocals() are pure introspection: none of the awaits in these tests suspend, so the class does not need an event loop and does not need to be skipped when there is no working socket. Drive the coroutines with support.run_no_yield_async_fn() instead, as the neighbouring TestGetCoroutineState already does, using the same _async_test decorator as test_contextlib_async. This also drops the last use of asyncio in the module.
test_easy_debugging and the three getasyncgenlocals tests never touch the async generator built by setUp; they built their own or used none at all. Move them to TestGetAsyncGenLocals, which needs no fixture.
|
Maybe we should move this helper to somewhere in |
|
Oh, right. I rewrote the decorator as |
|
it needs functools.wraps to copy in flags such as edit: I suppose you can put the skipIf/skip decorator on top of the
|
|
my |
|
@johnslavik I checked the test code and it never calls We should probably wait for these two PRs to merge before doing the refactor though |
inspect.getasyncgenstate() and getasyncgenlocals() are pure introspection: none of the awaits in these tests suspend, so the class does not need an event loop and does not need to be skipped when there is no working socket.
Drive the coroutines with support.run_no_yield_async_fn() instead, as the neighbouring TestGetCoroutineState already does, using the same _async_test decorator as test_contextlib_async. This also drops the last use of asyncio in the module.