From dc5b97943b7c921c7dd9a06f5b269c1ea81e60bd Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 16 Aug 2024 15:21:38 +0100 Subject: [PATCH 1/2] Minor improvements to testing docs (#8714) (cherry picked from commit 8690b0fb305d1a9cd8dab0ccad35142205b0d625) --- docs/testing.rst | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/docs/testing.rst b/docs/testing.rst index c2937b82282..b41e7687b58 100644 --- a/docs/testing.rst +++ b/docs/testing.rst @@ -32,20 +32,6 @@ insert ``pytest_plugins = 'aiohttp.pytest_plugin'`` line into -Provisional Status -~~~~~~~~~~~~~~~~~~ - -The module is a **provisional**. - -*aiohttp* has a year and half period for removing deprecated API -(:ref:`aiohttp-backward-compatibility-policy`). - -But for :mod:`aiohttp.test_tools` the deprecation period could be reduced. - -Moreover we may break *backward compatibility* without *deprecation -period* for some very strong reason. - - The Test Client and Servers ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -76,7 +62,12 @@ Pytest The :data:`aiohttp_client` fixture available from pytest-aiohttp_ plugin allows you to create a client to make requests to test your app. -A simple would be:: +To run these examples, you need to use `--asyncio-mode=auto` or add to your +pytest config file:: + + asyncio_mode = auto + +A simple test would be:: from aiohttp import web From 4f1f590dcde4a86be48cce149154c704f3cffcfb Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Fri, 16 Aug 2024 15:23:18 +0100 Subject: [PATCH 2/2] Update testing.rst --- docs/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/testing.rst b/docs/testing.rst index b41e7687b58..828b5072b4d 100644 --- a/docs/testing.rst +++ b/docs/testing.rst @@ -74,7 +74,7 @@ A simple test would be:: async def hello(request): return web.Response(text='Hello, world') - async def test_hello(aiohttp_client, loop): + async def test_hello(aiohttp_client): app = web.Application() app.router.add_get('/', hello) client = await aiohttp_client(app)