summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/async_case.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.11] gh-97837: Change deprecation warning message in `unittest` (GH-97838) ↵Miss Islington (bot)2022-10-051-1/+1
| | | | | | | | | | (GH-97887) (cherry picked from commit c3648f4e4a12ec6efe65684facfcd08996e550ca) Co-authored-by: Nikita Sobolev <mail@sobolevn.me> Automerge-Triggered-By: GH:orsenthil
* [3.11] GH-95736: fix IsolatedAsyncioTestCase to initialize Runner bef… ↵Kumar Aditya2022-08-181-0/+4
| | | | | | (#96042) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-45046: Support context managers in unittest (GH-28045)Miss Islington (bot)2022-05-081-0/+20
| | | | | | | | Add methods enterContext() and enterClassContext() in TestCase. Add method enterAsyncContext() in IsolatedAsyncioTestCase. Add function enterModuleContext(). (cherry picked from commit 086c6b1b0fe8d47ebd15512d7bdcb64c60a360f0) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-47062: Implement asyncio.Runner context manager (GH-31799)Andrew Svetlov2022-03-241-51/+19
| | | Co-authored-by: Zachary Ware <zach@python.org>
* bpo-46994: Accept explicit contextvars.Context in asyncio create_task() API ↵Andrew Svetlov2022-03-141-38/+17
| | | | (GH-31837)
* bpo-46129: Rewrite asyncio.locks tests with IsolatedAsyncioTestCase (GH-30198)Andrew Svetlov2021-12-191-1/+0
| | | Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
* Fix typos in the Lib directory (GH-28775)Christian Clauss2021-10-061-1/+1
| | | | | Fix typos in the Lib directory as identified by codespell. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* bpo-45238: Fix unittest.IsolatedAsyncioTestCase.debug() (GH-28449)Serhiy Storchaka2021-09-221-5/+14
| | | | | | It runs now asynchronous methods and callbacks. If it fails, doCleanups() can be called for cleaning up.
* bpo-41322: Add unit tests for deprecation of test return values (GH-27846)andrei kulakov2021-08-221-1/+1
| | | | Also fix the traceback of warnings.
* bpo-41322: added deprecation warning for tests returning value!=None (GH-27748)andrei kulakov2021-08-191-1/+4
|
* bpo-44911: Fixed IsolatedAsyncioTestCase from throwing an exception on ↵Bar Harel2021-08-161-1/+1
| | | | leaked tasks (GH-27765)
* bpo-39101: Fixes BaseException hang in IsolatedAsyncioTestCase. (GH-22654)Lisa Roach2020-10-261-2/+2
|
* bpo-36373: Fix deprecation warnings (GH-15889)Andrew Svetlov2019-09-111-4/+6
| | | https://bugs.python.org/issue36373
* bpo-32972: Async test case (GH-13386)Andrew Svetlov2019-05-291-0/+158
Add explicit `asyncSetUp` and `asyncTearDown` methods. The rest is the same as for #13228 `AsyncTestCase` create a loop instance for every test for the sake of test isolation. Sometimes a loop shared between all tests can speed up tests execution time a lot but it requires control of closed resources after every test finish. Basically, it requires nested supervisors support that was discussed with @1st1 many times. Sorry, asyncio supervisors have no chance to land on Python 3.8. The PR intentionally does not provide API for changing the used event loop or getting the test loop: use `asyncio.set_event_loop_policy()` and `asyncio.get_event_loop()` instead. The PR adds four overridable methods to base `unittest.TestCase` class: ``` def _callSetUp(self): self.setUp() def _callTestMethod(self, method): method() def _callTearDown(self): self.tearDown() def _callCleanup(self, function, /, *args, **kwargs): function(*args, **kwargs) ``` It allows using asyncio facilities with minimal influence on the unittest code. The last but not least: the PR respects contextvars. The context variable installed by `asyncSetUp` is available on test, `tearDown` and a coroutine scheduled by `addCleanup`. https://bugs.python.org/issue32972