summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_coroutines.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-114091: Reword error message for unawaitable types (#114090)Steele Farnsworth2024-06-171-3/+3
| | | | | Reword error message for unawaitable types.
* gh-116303: Skip test module dependent tests if test modules are unavailable ↵Erlend E. Aasland2024-04-031-0/+5
| | | | (#117341)
* gh-81682: Fix test failures when CPython is built without docstrings (GH-113410)Serhiy Storchaka2023-12-231-5/+6
|
* gh-111058: Change coro.cr_frame/gen.gi_frame to be None for a closed ↵Irit Katriel2023-12-011-0/+8
| | | | coroutine/generator. (#112428)
* GH-103805: Lib test f541 linting issue fix (#103812)Rodolfo M. Pereira2023-04-241-3/+3
| | | | | | | | | | | | | | | | This PR makes some minor linting adjustments to the Lib/test module caught by [ruff](https://github.com/charliermarsh/ruff). The adjustments are all related to the `F541 f-string without any placeholders` issue. Issue: https://github.com/python/cpython/issues/103805 <!-- gh-issue-number: gh-103805 --> * Issue: gh-103805 <!-- /gh-issue-number --> --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Gregory P. Smith <greg@krypto.org>
* gh-100600: Fix "coroutine was never awaited" warning in `test_coroutines` ↵Nikita Sobolev2022-12-291-0/+1
| | | | (#100601)
* gh-93453: No longer create an event loop in get_event_loop() (#98440)Serhiy Storchaka2022-12-061-1/+2
| | | | | | | | | | | | | | | 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-92886: make test_coroutines pass with -O (assertions off) (GH-98060)Irit Katriel2022-10-071-1/+1
| | | Automerge-Triggered-By: GH:iritkatriel
* gh-96348: Deprecate the 3-arg signature of coroutine.throw and ↵Ofey Chan2022-09-301-1/+8
| | | | generator.throw (GH-96428)
* Port regression test for issue GH-93592 (GH-96208)Kristján Valur Jónsson2022-08-261-0/+24
|
* gh-90473: Skip tests that don't apply to Emscripten and WASI (GH-92846)Christian Heimes2022-05-161-1/+2
|
* bpo-40280: Skip more tests on Emscripten (GH-31947)Christian Heimes2022-03-171-0/+3
| | | | | | - lchmod, lchown are not fully implemented - skip umask tests - cannot fstat unlinked or renamed files yet - ignore musl libc issues that affect Emscripten
* bpo-45813: Drop redundant assertion from frame.clear() (GH-29990)Andrew Svetlov2021-12-081-2/+11
| | | | | * bpo-45813: Drop redundant assertion from frame.clear() * Move assertion to frame_dealloc()
* bpo-45813: Make sure that frame->generator is NULLed when generator is ↵Mark Shannon2021-11-221-0/+7
| | | | deallocated. (GH-29700)
* bpo-33346: Allow async comprehensions inside implicit async comprehensions ↵Serhiy Storchaka2021-07-131-0/+72
| | | | | (GH-6766) Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
* bpo-12022: Change error type for bad objects in "with" and "async with" ↵Serhiy Storchaka2021-06-291-3/+3
| | | | | | | | | (GH-26809) A TypeError is now raised instead of an AttributeError in "with" and "async with" statements for objects which do not support the context manager or asynchronous context manager protocols correspondingly.
* bpo-44469: Fix tests for "async with" with bad object (GH-26817)Serhiy Storchaka2021-06-211-6/+12
| | | | Test for execution of the body was null. It would pass even if the code which should be skipped was executed.
* bpo-38605: Revert making 'from __future__ import annotations' the default ↵Pablo Galindo2021-04-211-0/+8
| | | | | | (GH-25490) This reverts commits 044a1048ca93d466965afc027b91a5a9eb9ce23c and 1be456ae9d53bb1cba2b24fc86175c282d1c2169, adapting the code to changes that happened after it.
* bpo-38605: Make 'from __future__ import annotations' the default (GH-20434)Batuhan Taskaya2020-10-061-8/+0
| | | | | The hard part was making all the tests pass; there are some subtle issues here, because apparently the future import wasn't tested very thoroughly in previous Python versions. For example, `inspect.signature()` returned type objects normally (except for forward references), but strings with the future import. We changed it to try and return type objects by calling `typing.get_type_hints()`, but fall back on returning strings if that function fails (which it may do if there are future references in the annotations that require passing in a specific namespace to resolve).
* bpo-40275: Use new test.support helper submodules in tests (GH-21449)Hai Shi2020-08-031-5/+8
|
* bpo-39048: Look up __aenter__ before __aexit__ in async with (GH-17609)Géry Ogam2020-01-141-9/+11
| | | | | | * Reorder the __aenter__ and __aexit__ checks for async with * Add assertions for async with body being skipped * Swap __aexit__ and __aenter__ loading in the documentation
* bpo-37069: tests use catch_unraisable_exception() (GH-13762)Victor Stinner2019-06-031-3/+9
| | | | | | | | | | | | | Modify test_coroutines, test_cprofile, test_generators, test_raise, test_ssl and test_yield_from to use support.catch_unraisable_exception() rather than support.captured_stderr(). test_thread: remove test_save_exception_state_on_error() which is now updated. test_unraisable_exception() checks that sys.unraisablehook() is called to handle _thread.start_new_thread() exception. test_cprofile now rely on unittest for test discovery: replace support.run_unittest() with unittest.main().
* bpo-37100: Fix test_coroutines with -Werror (GH-13756)Victor Stinner2019-06-021-4/+4
| | | | test_coroutines: test_unawaited_warning_when_module_broken() now uses support.check_warnings() to catch expected RuntimeWarning.
* bpo-36933: Remove sys.set_coroutine_wrapper (marked for removal in 3.8) ↵Matthias Bussonnier2019-05-281-93/+0
| | | | | | | | | | (GH-13577) It has been documented as deprecated and to be removed in 3.8; From a comment on another thread – which I can't find ; leave get_coro_wrapper() for now, but always return `None`. https://bugs.python.org/issue36933
* bpo-36829: Add test.support.catch_unraisable_exception() (GH-13490)Victor Stinner2019-05-221-5/+12
| | | | | | * Copy test_exceptions.test_unraisable() to test_sys.UnraisableHookTest(). * Use catch_unraisable_exception() in test_coroutines, test_exceptions, test_generators.
* bpo-35202: Remove unused imports in tests. (GH-10561)Srinivas Thatiparthy (శ్రీనివాస్ తాటిపర్తి)2018-11-161-1/+0
|
* bpo-33562: Check the global asyncio event loop policy isn't set after any ↵Brett Cannon2018-06-021-1/+1
| | | | tests (GH-7328)
* bpo-33363: raise SyntaxError for async for/with outside async functions (#6616)Zsolt Dollenstein2018-04-271-1/+16
|
* bpo-29922: Add more tests for error messages in 'async with'. (GH-6370)Serhiy Storchaka2018-04-041-1/+41
| | | | Different paths are executed for normal exit and for leaving the 'async with' block with 'break', 'continue' or 'return'.
* bpo-29922: Improve error messages in 'async with' (GH-6352)Serhiy Storchaka2018-04-021-4/+9
| | | when __aenter__() or __aexit__() return non-awaitable object.
* bpo-33041: Rework compiling an "async for" loop. (#6142)Serhiy Storchaka2018-03-231-0/+30
| | | | | | | | * Added new opcode END_ASYNC_FOR. * Setting global StopAsyncIteration no longer breaks "async for" loops. * Jumping into an "async for" loop is now disabled. * Jumping out of an "async for" loop no longer corrupts the stack. * Simplify the compiler.
* bpo-33041: Fixed bytecode generation for "async for" with a complex target. ↵Serhiy Storchaka2018-03-101-0/+65
| | | | | | (#6052) A StopAsyncIteration raised on assigning or unpacking will be now propagated instead of stopping the iteration.
* bpo-32733: Make test_coroutines robust against -Werror (GH-5487)Nathaniel J. Smith2018-02-021-7/+2
|
* bpo-32703: Fix coroutine resource warning in case where there's an error ↵Yury Selivanov2018-01-291-33/+63
| | | | | (GH-5410) The commit removes one unnecessary "if" clause in genobject.c. That "if" clause was masking un-awaited coroutines warnings just to make writing unittests more convenient.
* bpo-32591: silence deprecation warnings in test_coroutine (GH-5412)Nathaniel J. Smith2018-01-291-10/+20
|
* bpo-32591: fix abort in _PyErr_WarnUnawaitedCoroutine during shutdown (#5337)Nathaniel J. Smith2018-01-261-0/+22
| | | | | | | | | | | | | | | | | | When an unawaited coroutine is collected very late in shutdown -- like, during the final GC at the end of PyImport_Cleanup -- then it was triggering an interpreter abort, because we'd try to look up the "warnings" module and not only was it missing (we were prepared for that), but the entire module system was missing (which we were not prepared for). I've tried to fix this at the source, by making the utility function get_warnings_attr robust against this in general. Note that it already has the convention that it can return NULL without setting an error, which is how it signals that the attribute it was asked to fetch is missing, and that all callers already check for NULL returns. There's a similar check for being late in shutdown at the top of warn_explicit, which might be unnecessary after this fix, but I'm not sure so I'm going to leave it.
* bpo-32591: Add native coroutine origin tracking (#5250)Nathaniel J. Smith2018-01-211-2/+129
| | | | | | * Add coro.cr_origin and sys.set_coroutine_origin_tracking_depth * Use coroutine origin information in the unawaited coroutine warning * Stop using set_coroutine_wrapper in asyncio debug mode * In BaseEventLoop.set_debug, enable debugging in the correct thread
* bpo-31708: Allow async generator expressions in synchronous functions (#3905)Yury Selivanov2017-10-061-0/+8
|
* bpo-31709: Drop support for asynchronous __aiter__. (#3903)Yury Selivanov2017-10-061-91/+19
|
* bpo-30406: Make async and await proper keywords (#1669)Jelle Zijlstra2017-10-061-18/+6
| | | Per PEP 492, 'async' and 'await' should become proper keywords in 3.7.
* bpo-29845: Mark tests that use _testcapi as CPython-only (#711)Serhiy Storchaka2017-03-191-0/+1
|
* Fix wrapping into StopIteration of return values in generators and ↵Yury Selivanov2017-03-121-0/+15
| | | | coroutines (#644)
* bpo-28893: Set __cause__ for errors in async iteration protocol (#407)Yury Selivanov2017-03-031-0/+38
|
* Issue #27243: Change PendingDeprecationWarning -> DeprecationWarning.Yury Selivanov2016-11-081-9/+9
| | | | | | As it was agreed in the issue, __aiter__ returning an awaitable should result in PendingDeprecationWarning in 3.5 and in DeprecationWarning in 3.6.
* Issue #23996: Added _PyGen_SetStopIterationValue for safe raisingSerhiy Storchaka2016-11-061-0/+61
|\ | | | | | | | | StopIteration with value. More safely handle non-normalized exceptions in -_PyGen_FetchStopIterationValue.
| * Issue #23996: Added _PyGen_SetStopIterationValue for safe raisingSerhiy Storchaka2016-11-061-0/+61
| | | | | | | | | | StopIteration with value. More safely handle non-normalized exceptions in -_PyGen_FetchStopIterationValue.
* | Issue #26182: Raise DeprecationWarning for improper use of async/await keywordsYury Selivanov2016-09-151-42/+95
| |
* | Issue #28008: Implement PEP 530 -- asynchronous comprehensions.Yury Selivanov2016-09-091-32/+292
| |
* | Issue #28003: Implement PEP 525 -- Asynchronous Generators.Yury Selivanov2016-09-091-6/+0
| |
* | #27364: fix "incorrect" uses of escape character in the stdlib.R David Murray2016-09-081-4/+4
|/ | | | | | | And most of the tools. Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and Martin Panter.