Skip to content

Commit

Permalink
[PR #8714/8690b0fb backport][3.10] Minor improvements to testing docs (
Browse files Browse the repository at this point in the history
…#8715)

**This is a backport of PR #8714 as merged into master
(8690b0f).**

---------

Co-authored-by: Sam Bull <git@sambull.org>
  • Loading branch information
patchback[bot] and Dreamsorcerer authored Aug 16, 2024
1 parent 58e8597 commit 677f6af
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions docs/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 677f6af

Please sign in to comment.