summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/async_case.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.10] gh-91676 gh-91260 unittest.IsolatedAsyncioTestCase no longer leaks ↵Gregory P. Smith2022-04-191-0/+2
| | | | | | | its executor (GH-91680) For things like test_asyncio.test_thread this was causing frequent "environment modified by test" errors as the executor threads had not always stopped running after the test was over.
* [3.10] bpo-46129: Rewrite asyncio.locks tests with IsolatedAsyncioTestCase ↵Andrew Svetlov2021-12-191-1/+0
| | | | | | | | (GH-30198) (GH-30202) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>. (cherry picked from commit 9c06fd89514a9a2865e2adcc472095f6949cecb2) Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
* [3.10] Fix typos in the Lib directory (GH-28775) (GH-28804)Christian Clauss2021-10-071-1/+1
| | | | | | | | Fix typos in the Lib directory as identified by codespell. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>. (cherry picked from commit 745c9d9dfc1ad6fdfdf1d07420c6273ff67fa5be) Co-authored-by: Christian Clauss <cclauss@me.com>
* [3.10] bpo-45238: Fix unittest.IsolatedAsyncioTestCase.debug() (GH-28449) ↵Łukasz Langa2021-09-221-5/+14
| | | | | | | | | | (GH-28521) It runs now asynchronous methods and callbacks. If it fails, doCleanups() can be called for cleaning up. (cherry picked from commit ecb6922ff2d56476a6cfb0941ae55aca5e7fae3d) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-44911: Fixed IsolatedAsyncioTestCase from throwing an exception on ↵Miss Islington (bot)2021-08-161-1/+1
| | | | | | | leaked tasks (GH-27765) (cherry picked from commit 2cb1a6806c0cefab0c3a40fdd428a89a4392570e) Co-authored-by: Bar Harel <bar.harel@biocatch.com>
* 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