summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2019-05-29 09:33:59 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-05-29 09:33:59 (GMT)
commit4dd3e3f9bbd320f0dd556688e04db0a6b55a7b52 (patch)
tree405a7629dbb3ef8e53cfa873443ec4eacdf3a1b5 /configure.ac
parent7d408697a96953a182328ec0b0650e9999da4116 (diff)
downloadcpython-4dd3e3f9bbd320f0dd556688e04db0a6b55a7b52.zip
cpython-4dd3e3f9bbd320f0dd556688e04db0a6b55a7b52.tar.gz
cpython-4dd3e3f9bbd320f0dd556688e04db0a6b55a7b52.tar.bz2
bpo-32972: Async test case (GH-13386)
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
Diffstat (limited to 'configure.ac')
0 files changed, 0 insertions, 0 deletions