From 677f6af46c375a0eb2b43bc254ae69967815e52b Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Fri, 16 Aug 2024 16:43:12 +0100 Subject: [PATCH] [PR #8714/8690b0fb backport][3.10] Minor improvements to testing docs (#8715) **This is a backport of PR #8714 as merged into master (8690b0fb305d1a9cd8dab0ccad35142205b0d625).** --------- Co-authored-by: Sam Bull --- docs/testing.rst | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/docs/testing.rst b/docs/testing.rst index c2937b82282..828b5072b4d 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,14 +62,19 @@ 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 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)