Closed EdwardBetts closed 2 months ago
This works fine for me (I need to remove the loop fixture from the docs, which triggers a DeprecationWarning):
from aiohttp import web
async def hello(request):
return web.Response(text='Hello, world')
async def test_hello(aiohttp_client):
app = web.Application()
app.router.add_get('/', hello)
client = await aiohttp_client(app)
resp = await client.get('/')
assert resp.status == 200
text = await resp.text()
assert 'Hello, world' in text
> pytest --asyncio-mode=auto test_server.py
Test session starts (platform: linux, Python 3.10.12, pytest 8.3.2, pytest-sugar 0.9.7)
rootdir: /home/ubuntu/desktop
plugins: timeout-2.1.0, forked-1.4.0, anyio-3.6.2, sugar-0.9.7, mock-3.11.1, cov-4.1.0, toolbox-0.4, metadata-3.0.0, jest-0.3.0, aresponses-3.0.0, asyncio-0.23.8, aiohttp-1.0.5, web3-6.15.1
asyncio: mode=auto
collected 1 item
test_server.py ✓ 100% ██████████
Results (0.16s):
1 passed
Note that like your other bug report, I have significantly less plugins than you. Maybe you should start by uninstalling a load of old, broken plugins?
Thanks for your help. Sorry for the bad bug report.
Describe the bug
I tried running the example
client = await aiohttp_client(app)
pytest example from testing.rst, but it doesn't work.To Reproduce
Run pytest client example from testing.rst
Expected behavior
Test passes
Logs/tracebacks
Python Version
aiohttp Version
multidict Version
yarl Version
OS
Debian GNU/Linux
Related component
Client
Additional context
No response
Code of Conduct