cpython/Lib/test/test_asyncio
Guido van Rossum 602630ac18
bpo-46752: Add TaskGroup; add Task..cancelled(),.uncancel() (GH-31270)
asyncio/taskgroups.py is an adaptation of taskgroup.py from EdgeDb, with the following key changes:

- Allow creating new tasks as long as the last task hasn't finished
- Raise [Base]ExceptionGroup (directly) rather than TaskGroupError deriving from MultiError
- Instead of monkey-patching the parent task's cancel() method,
  add a new public API to Task

The Task class has a new internal flag, `_cancel_requested`, which is set when `.cancel()` is called successfully. The `.cancelling()` method returns the value of this flag. Further `.cancel()` calls while this flag is set return False. To reset this flag, call `.uncancel()`.

Thus, a Task that catches and ignores `CancelledError` should call `.uncancel()` if it wants to be cancellable again; until it does so, it is deemed to be busy with uninterruptible cleanup.

This new Task API helps solve the problem where TaskGroup needs to distinguish between whether the parent task being cancelled "from the outside" vs. "from inside".

Co-authored-by: Yury Selivanov <yury@edgedb.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2022-02-15 15:42:04 -08:00
..
__init__.py
__main__.py
echo.py
echo2.py
echo3.py
functional.py bpo-45011: Fix test_asyncio without C module _asyncio (GH-27968) 2021-08-26 14:48:24 +02:00
test_asyncio_waitfor.py
test_base_events.py bpo-44011: New asyncio ssl implementation (#31275) 2022-02-15 15:04:00 +02:00
test_buffered_proto.py
test_context.py bpo-46425: fix direct invocation of `asyncio` tests (#30725) 2022-01-22 13:06:27 +02:00
test_events.py bpo-46358: modernize `test_asyncio` (GH-30562) 2022-01-13 23:28:02 +09:00
test_futures.py bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777) 2022-01-22 13:28:53 +02:00
test_futures2.py Fix warning: asyncio.events._event_loop_policy was modified by test_asyncio (GH-31253) 2022-02-10 14:57:20 +02:00
test_locks.py bpo-46129: Rewrite asyncio.locks tests with IsolatedAsyncioTestCase (GH-30198) 2021-12-19 16:35:56 +02:00
test_pep492.py bpo-43216: Remove @asyncio.coroutine (GH-26369) 2021-07-01 15:13:59 +02:00
test_proactor_events.py bpo-23819: Fix asyncio tests on python optimized mode (GH-30195) 2021-12-26 13:13:14 +02:00
test_protocols.py Fix warning: asyncio.events._event_loop_policy was modified by test_asyncio (GH-31253) 2022-02-10 14:57:20 +02:00
test_queues.py bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777) 2022-01-22 13:28:53 +02:00
test_runners.py Fix warning: asyncio.events._event_loop_policy was modified by test_asyncio (GH-31253) 2022-02-10 14:57:20 +02:00
test_selector_events.py bpo-44011: New asyncio ssl implementation (#31275) 2022-02-15 15:04:00 +02:00
test_sendfile.py fixed flaky test (GH-30845) 2022-01-24 21:04:47 +00:00
test_server.py
test_sock_lowlevel.py Fix warning: asyncio.events._event_loop_policy was modified by test_asyncio (GH-31253) 2022-02-10 14:57:20 +02:00
test_ssl.py bpo-44011: New asyncio ssl implementation (#31275) 2022-02-15 15:04:00 +02:00
test_sslproto.py bpo-44011: New asyncio ssl implementation (#31275) 2022-02-15 15:04:00 +02:00
test_streams.py bpo-23819: Get rid of assert statements in test_asyncio (GH-30212) 2021-12-20 12:23:05 +02:00
test_subprocess.py Fix typos in the Lib directory (GH-28775) 2021-10-06 16:13:48 -07:00
test_taskgroups.py bpo-46752: Add TaskGroup; add Task..cancelled(),.uncancel() (GH-31270) 2022-02-15 15:42:04 -08:00
test_tasks.py bpo-46752: Add TaskGroup; add Task..cancelled(),.uncancel() (GH-31270) 2022-02-15 15:42:04 -08:00
test_threads.py
test_transports.py Fix warning: asyncio.events._event_loop_policy was modified by test_asyncio (GH-31253) 2022-02-10 14:57:20 +02:00
test_unix_events.py Fix warning: asyncio.events._event_loop_policy was modified by test_asyncio (GH-31253) 2022-02-10 14:57:20 +02:00
test_windows_events.py fix DeprecationWarning when running asyncio tests (GH-30486) 2022-01-22 13:20:10 +02:00
test_windows_utils.py bpo-44287: asyncio test_popen() uses longer timeout (GH-26832) 2021-06-22 01:58:19 +02:00
utils.py bpo-23819: Get rid of assert statements in test_asyncio (GH-30212) 2021-12-20 12:23:05 +02:00