From 76c85ad2126fed786a2605eba00ebfd9241e72b3 Mon Sep 17 00:00:00 2001 From: Hoel IRIS Date: Mon, 15 Nov 2021 14:33:05 +0100 Subject: [PATCH] docs: Fix statement about `setUpAsync()` and `tearDownAsync()` Since https://github.com/aio-libs/aiohttp/pull/4732, it's wrong to says that `setUpAsync()` and `tearDownAsync()` do nothing and can be overridden without calling `super.setUpAsync()` and `super.tearDownAsync()`. --- docs/testing.rst | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/docs/testing.rst b/docs/testing.rst index 35fbb9a3463..42aa1fe7cc7 100644 --- a/docs/testing.rst +++ b/docs/testing.rst @@ -369,18 +369,34 @@ functionality, the AioHTTPTestCase is provided:: .. comethod:: setUpAsync() - This async method do nothing by default and can be overridden to execute - asynchronous code during the ``setUp`` stage of the ``TestCase``. + This async method can be overridden to execute asynchronous code during + the ``setUp`` stage of the ``TestCase``:: + + async def setUpAsync(self): + await super().setUpAsync() + await foo() .. versionadded:: 2.3 + .. versionchanged:: 3.8 + + ``await super().setUpAsync()`` call is required. + .. comethod:: tearDownAsync() - This async method do nothing by default and can be overridden to execute - asynchronous code during the ``tearDown`` stage of the ``TestCase``. + This async method can be overridden to execute asynchronous code during + the ``tearDown`` stage of the ``TestCase``:: + + async def tearDownAsync(self): + await super().tearDownAsync() + await foo() .. versionadded:: 2.3 + .. versionchanged:: 3.8 + + `await super().tearDownAsync()` call is required. + .. method:: setUp() Standard test initialization method.