From ad634a7de8a27bb2f95433fe6019fd0fab493b7e Mon Sep 17 00:00:00 2001 From: Hoel IRIS Date: Tue, 16 Nov 2021 15:09:40 +0100 Subject: [PATCH] docs: Fix statement about `setUpAsync()` and `tearDownAsync()` (#6313) 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()`. (cherry picked from commit d149eff62e1e110d2eafac8a79219dd2e56b8581) --- docs/testing.rst | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/docs/testing.rst b/docs/testing.rst index 7747a0abceb..828c3d03e4f 100644 --- a/docs/testing.rst +++ b/docs/testing.rst @@ -322,18 +322,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.