summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_contextlib_async.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.10] gh-95882: Add tests for traceback from contextlib context managers ↵Irit Katriel2023-01-031-0/+58
| | | | (GH-95883) (#100715)
* GH-89369: test_contextlib_async finalizes event loop after each test (GH-93074)Miss Islington (bot)2022-05-241-7/+4
| | | | | | Use asyncio.run(). (cherry picked from commit d2ef66a10be1250b13c32fbf3c0f9a9d2d98b124) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* [3.10] gh-92118: Add test for traceback when exception is modified by ↵Miss Islington (bot)2022-05-051-0/+7
| | | | (Async)ExitStack.__exit__ (GH-92339) (GH-92343)
* [3.10] bpo-44594: fix (Async)ExitStack handling of __context__ (gh-27089) ↵John Belmonte2021-10-051-0/+35
| | | | | | | | | | | | | | (GH-28730) Make enter_context(foo()) / enter_async_context(foo()) equivalent to `[async] with foo()` regarding __context__ when an exception is raised. Previously exceptions would be caught and re-raised with the wrong context when explicitly overriding __context__ with None.. (cherry picked from commit e6d1aa1ac65b6908fdea2c70ec3aa8c4f1dffcb5) Co-authored-by: John Belmonte <john@neggie.net> Automerge-Triggered-By: GH:njsmith
* bpo-44515: handle non-refcounted GC in contextlib tests (GH-26910) (GH-27379)Miss Islington (bot)2021-07-261-6/+9
| | | | | | Co-authored-by: Łukasz Langa <lukasz@langa.pl> (cherry picked from commit a2c45e5bcf9d3dfff9f2699dbc161489897616b5) Co-authored-by: Nick Coghlan <ncoghlan@gmail.com>
* bpo-44566: resolve differences between asynccontextmanager and ↵Miss Islington (bot)2021-07-201-1/+12
| | | | | | | contextmanager (GH-27024) (#27266) (cherry picked from commit 7f1c330da31c54e028dceaf3610877914c2a4497) Co-authored-by: Thomas Grainger <tagrain@gmail.com>
* bpo-41543: contextlib.nullcontext can fill in for an async context manager ↵Tom Gringauz2020-11-091-1/+13
| | | | | (GH-21870) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* bpo-40816 Add AsyncContextDecorator class (GH-20516)Kazantcev Andrey2020-11-051-0/+27
| | | | Co-authored-by: Yury Selivanov <yury@edgedb.com>
* bpo-41229: Update docs for explicit aclose()-required cases and add ↵Joongi Kim2020-11-021-1/+58
| | | | | | | | | | | | | | | | | | | contextlib.aclosing() method (GH-21545) This is a PR to: * Add `contextlib.aclosing` which ia analogous to `contextlib.closing` but for async-generators with an explicit test case for [bpo-41229]() * Update the docs to describe when we need explicit `aclose()` invocation. which are motivated by the following issues, articles, and examples: * [bpo-41229]() * https://github.com/njsmith/async_generator * https://vorpus.org/blog/some-thoughts-on-asynchronous-api-design-in-a-post-asyncawait-world/#cleanup-in-generators-and-async-generators * https://www.python.org/dev/peps/pep-0533/ * https://github.com/achimnol/aiotools/blob/ef7bf0cea7af/src/aiotools/context.py#L152 Particuarly regarding [PEP-533](https://www.python.org/dev/peps/pep-0533/), its acceptance (`__aiterclose__()`) would make this little addition of `contextlib.aclosing()` unnecessary for most use cases, but until then this could serve as a good counterpart and analogy to `contextlib.closing()`. The same applies for `contextlib.closing` with `__iterclose__()`. Also, still there are other use cases, e.g., when working with non-generator objects with `aclose()` methods.
* [3.9] bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-12620)Serhiy Storchaka2019-06-051-2/+2
| | | Turn deprecation warnings added in 3.8 into TypeError.
* bpo-36492: Deprecate passing some arguments as keyword arguments. (GH-12637)Serhiy Storchaka2019-04-011-0/+10
| | | | | | | | | | | | | | | | | | | | | | Deprecated passing the following arguments as keyword arguments: - "func" in functools.partialmethod(), weakref.finalize(), profile.Profile.runcall(), cProfile.Profile.runcall(), bdb.Bdb.runcall(), trace.Trace.runfunc() and curses.wrapper(). - "function" in unittest.addModuleCleanup() and unittest.TestCase.addCleanup(). - "fn" in the submit() method of concurrent.futures.ThreadPoolExecutor and concurrent.futures.ProcessPoolExecutor. - "callback" in contextlib.ExitStack.callback(), contextlib.AsyncExitStack.callback() and contextlib.AsyncExitStack.push_async_callback(). - "c" and "typeid" in the create() method of multiprocessing.managers.Server and multiprocessing.managers.SharedMemoryServer. - "obj" in weakref.finalize(). Also allowed to pass arbitrary keyword arguments (even "self" and "func") if the above arguments are passed as positional argument.
* bpo-34183: Fix running Lib/test/test_contextlib_async.py as a script. (GH-8381)Serhiy Storchaka2018-07-231-1/+1
|
* bpo-33786: Fix asynchronous generators to handle GeneratorExit in athrow() ↵Yury Selivanov2018-06-081-0/+22
| | | | (GH-7467)
* bpo-33562: Check the global asyncio event loop policy isn't set after any ↵Brett Cannon2018-06-021-1/+2
| | | | tests (GH-7328)
* bpo-29302: Implement contextlib.AsyncExitStack. (#4790)Ilya Kulakov2018-01-251-1/+166
|
* bpo-30241: implement contextlib.AbstractAsyncContextManager (#1412)Jelle Zijlstra2017-12-141-1/+48
|
* bpo-29679: Implement @contextlib.asynccontextmanager (#360)Jelle Zijlstra2017-05-011-0/+212