From c693b74cf2cca4dd210cbbf81486314269d33b0e Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Tue, 16 Nov 2021 14:25:55 +0000 Subject: [PATCH] docs: Fix statement about `setUpAsync()` and `tearDownAsync()` (#6313) (#6318) 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) Co-authored-by: Hoel IRIS --- 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.