aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_asyncio/test_tasks.py
Commit message (Collapse)AuthorAge
* gh-130322: drop deprecation of `asyncio.set_event_loop` (#132349)Kumar Aditya2025-04-12
|
* fix various warnings in `test_asyncio.test_tasks` (#131109)Kumar Aditya2025-03-11
|
* improve `test_tasks` to use correct idiom for starting task in asyncio (#130257)Kumar Aditya2025-02-18
| | | The test should use the correct idiom for starting the task, `loop._run_once` is private API which should not be used directly, instead use `asyncio.sleep(0)` for 1 event loop cycle.
* gh-129289: fix crash when task finalizer is not called in asyncio (#129840)Kumar Aditya2025-02-10
|
* gh-129874: improve `test_tasks` in asyncio to use correct internal functions ↵Kumar Aditya2025-02-09
| | | | (#129890)
* improve `test_log_destroyed_pending_task` in asyncio (#129821)Kumar Aditya2025-02-07
|
* fix tests in `test_asyncio.test_tasks` to use correct `all_tasks` (#129815)Kumar Aditya2025-02-07
|
* gh-71339: Use new assertion methods in `test_asyncio` (#129051)Serhiy Storchaka2025-01-20
|
* gh-127949: deprecate `asyncio.set_event_loop` (#128218)Kumar Aditya2024-12-24
| | | Deprecate `asyncio.set_event_loop` to be removed in Python 3.16.
* gh-127949: fix resource warnings in `test_tasks.py` (#128172)Thomas Grainger2024-12-22
|
* gh-127949: deprecate `asyncio.set_event_loop_policy` (#128024)Kumar Aditya2024-12-18
| | | | First step towards deprecating the asyncio policy system. This deprecates `asyncio.set_event_loop_policy` and will be removed in Python 3.16.
* gh-126083: Fix a reference leak in `asyncio.Task` when reinitializing with ↵Nico-Posada2024-10-31
| | | | new non-`None` context (#126103)
* gh-122858: Deprecate `asyncio.iscoroutinefunction` (#122875)Wulian2024-08-11
| | | | | Deprecate `asyncio.iscoroutinefunction` in favor of `inspect.iscoroutinefunction`. Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* GH-107803: double linked list implementation for asyncio tasks (GH-107804)Kumar Aditya2024-06-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * linked list * add tail optmiization to linked list * wip * wip * wip * more fixes * finally it works * add tests * remove weakreflist * add some comments * reduce code duplication in _asynciomodule.c * address some review comments * add invariants about the state of the linked list * add better explanation * clinic regen * reorder branches for better branch prediction * Update Modules/_asynciomodule.c * Apply suggestions from code review Co-authored-by: Itamar Oren <itamarost@gmail.com> * fix capturing of eager tasks * add comment to task finalization * fix tests and couple c implmentation to c task improved linked-list logic and more comments * fix test --------- Co-authored-by: Itamar Oren <itamarost@gmail.com>
* gh-120417: Add #noqa: F401 to tests (#120627)Victor Stinner2024-06-18
| | | | Ignore linter "imported but unused" warnings in tests when the linter doesn't understand how the import is used.
* gh-116720: Fix corner cases of taskgroups (#117407)Guido van Rossum2024-04-09
| | | | | | | | | | This prevents external cancellations of a task group's parent task to be dropped when an internal cancellation happens at the same time. Also strengthen the semantics of uncancel() to clear self._must_cancel when the cancellation count reaches zero. Co-Authored-By: Tin Tvrtković <tinchester@gmail.com> Co-Authored-By: Arthur Tacca
* gh-77714: Provide an async iterator version of as_completed (GH-22491)Justin Turner Arthur2024-04-01
| | | | | | | | | * as_completed returns object that is both iterator and async iterator * Existing tests adjusted to test both the old and new style * New test to ensure iterator can be resumed * New test to ensure async iterator yields any passed-in Futures as-is Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
* gh-105331: Change `asyncio.sleep` to raise ``ValueError` for nan (#105641)Jay2023-06-12
| | | | Co-authored-by: Guido van Rossum <gvanrossum@gmail.com> Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-103793: Defer formatting task name (#103767)Itamar Ostricher2023-04-29
| | | | | | | | | | | | | The default task name is "Task-<counter>" (if no name is passed in during Task creation). This is initialized in `Task.__init__` (C impl) using string formatting, which can be quite slow. Actually using the task name in real world code is not very common, so this is wasted init. Let's defer this string formatting to the first time the name is read (in `get_name` impl), so we don't need to pay the string formatting cost if the task name is never read. We don't change the order in which tasks are assigned numbers (if they are) -- the number is set on task creation, as a PyLong instead of a formatted string. Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* gh-102799: use sys.exception() instead of sys.exc_info() in tests (#103293)Irit Katriel2023-04-06
|
* GH-78530: add support for generators in `asyncio.wait` (#102761)Kumar Aditya2023-03-17
|
* GH-100112: avoid using iterable coroutines in asyncio internally (#100128)Kumar Aditya2023-03-16
|
* gh-100344: Add C implementation for `asyncio.current_task` (#100345)Itamar Ostricher2022-12-22
| | | Co-authored-by: pranavtbhat
* GH-100113: remove remaining `yield from` usage from `asyncio` tests (#100114)Kumar Aditya2022-12-09
|
* gh-93453: No longer create an event loop in get_event_loop() (#98440)Serhiy Storchaka2022-12-06
| | | | | | | | | | | | | | | asyncio.get_event_loop() now always return either running event loop or the result of get_event_loop_policy().get_event_loop() call. The latter should now raise an RuntimeError if no current event loop was set instead of creating and setting a new event loop. It affects also a number of asyncio functions and constructors which call get_event_loop() implicitly: ensure_future(), shield(), gather(), etc. DeprecationWarning is no longer emitted if there is no running event loop but the current event loop was set. Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* gh-99357: Close the event loop when it is no longer used in ↵Xiao Chen2022-11-12
| | | | test_uncancel_structured_blocks (#99414)
* GH-90985: Revert "Deprecate passing a message into cancel()" (#97999)Guido van Rossum2022-10-06
| | | | | Reason: we were too hasty in deprecating this. We shouldn't deprecate it before we have a replacement.
* GH-96704: Add {Task,Handle}.get_context(), use it in ↵Guido van Rossum2022-10-04
| | | | | call_exception_handler() (#96756) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* gh-90908: Document asyncio.Task.cancelling() and asyncio.Task.uncancel() ↵Łukasz Langa2022-10-01
| | | | | | (#95253) Co-authored-by: Thomas Grainger <tagrain@gmail.com>
* gh-91323: Revert "Allow overriding a future compliance check in asyncio.Task ↵Łukasz Langa2022-08-04
| | | | | | (GH-32197)" (GH-95442) This reverts commit d4bb38f82bf18b00db3129031ce4969b6f0caab9.
* gh-84753: Make inspect.iscoroutinefunction() work with AsyncMock (#94050)Mehdi ABAAKOUK2022-06-30
| | | | | | | | | The inspect version was not working with unittest.mock.AsyncMock. The fix introduces special-casing of AsyncMock in `inspect.iscoroutinefunction` equivalent to the one performed in `asyncio.iscoroutinefunction`. Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* gh-84623: Remove unused imports in tests (#93772)Victor Stinner2022-06-13
|
* Simplify testing the warning filename (GH-91868)Serhiy Storchaka2022-04-24
| | | The context manager result has the "filename" attribute.
* bpo-47167: Allow overriding a future compliance check in asyncio.Task (GH-32197)Andrew Svetlov2022-04-01
|
* bpo-46829: Deprecate passing a message into Future.cancel() and ↵Andrew Svetlov2022-03-23
| | | | | Task.cancel() (GH-31840) After a long deliberation we ended up feeling that the message argument for Future.cancel(), added in 3.9, was a bad idea, so we're deprecating it in 3.11 and plan to remove it in 3.13.
* bpo-34790: Remove passing coroutine objects to asyncio.wait() (GH-31964)Andrew Svetlov2022-03-17
| | | Co-authored-by: Yury Selivanov <yury@edgedb.com>
* bpo-47038: Rewrite missed asyncio.wait_for test to use ↵Andrew Svetlov2022-03-17
| | | | IsolatedAnsyncioTestCase (GH-31946)
* bpo-47038: Rewrite asyncio.wait_for test to use IsolatedAsyncioTestCase ↵Andrew Svetlov2022-03-16
| | | | (GH-31942)
* bpo-46994: Accept explicit contextvars.Context in asyncio create_task() API ↵Andrew Svetlov2022-03-14
| | | | (GH-31837)
* bpo-46995: Deprecate missing asyncio.Task.set_name() for third-party task ↵Andrew Svetlov2022-03-13
| | | | | implementations (GH-31838) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* bpo-46771: Remove two controversial lines from Task.cancel() (GH-31623)Guido van Rossum2022-02-28
| | | | | | | | | | | | | | | Also from the _asyncio C accelerator module, and adjust one test that the change caused to fail. For more discussion see the discussion starting here: https://github.com/python/cpython/pull/31394#issuecomment-1053545331 (Basically, @asvetlov proposed to return False from cancel() when there is already a pending cancellation, and I went along, even though it wasn't necessary for the task group implementation, and @agronholm has come up with a counterexample that fails because of this change. So now I'm changing it back to the old semantics (but still bumping the counter) until we can have a proper discussion about this.)
* bpo-45390: Propagate CancelledError's message from cancelled task to its ↵Andrew Svetlov2022-02-21
| | | | | | awaiter (GH-31383) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-46672: fix `NameError` in `asyncio.gather` if type check fails (GH-31187)Nikita Sobolev2022-02-20
| | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* bpo-46752: Add TaskGroup; add Task..cancelled(),.uncancel() (GH-31270)Guido van Rossum2022-02-15
| | | | | | | | | | | | | | | | | 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>
* bpo-46469: Make asyncio generic classes return GenericAlias (GH-30777)Kumar Aditya2022-01-22
| | | | | | | | | | | | * bpo-46469: Make asyncio generic classes return GenericAlias * 📜🤖 Added by blurb_it. * Update Misc/NEWS.d/next/Library/2022-01-22-05-05-08.bpo-46469.plUab5.rst Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* bpo-23819: Get rid of assert statements in test_asyncio (GH-30212)Serhiy Storchaka2021-12-20
| | | | | | To keep checks even if run tests with optimized Python. Either use special assertion methods like assertEqual() or raise an AssertionError explicitly.
* bpo-37658: Actually return result in race condition (GH-29202)Sam Bull2021-11-29
|
* Fix typos in the Lib directory (GH-28775)Christian Clauss2021-10-06
| | | | | Fix typos in the Lib directory as identified by codespell. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* bpo-25130: Add calls of gc.collect() in tests to support PyPy (GH-28005)Serhiy Storchaka2021-08-29
|
* bpo-45011: Fix test_asyncio without C module _asyncio (GH-27968)Serhiy Storchaka2021-08-26
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>