pytest plugin for aiohttp support
Switch branches/tags
Nothing to show
Clone or download
Latest commit 1fec261 Jan 3, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
pytest_aiohttp Bump to 0.3.0 Dec 5, 2017
.gitignore Initial commit Jul 15, 2016
CHANGES.rst Release 0.2.0 Nov 30, 2017
LICENSE Update LICENSE Jan 3, 2018
MANIFEST.in Add manifest Sep 8, 2016
README.rst Use code-block directive for syntax highlights. (#5) Jul 7, 2017
setup.py Bump to 0.3.0 Dec 5, 2017

README.rst

pytest-aiohttp

pytest plugin for aiohttp support

The library allows to use aiohttp pytest plugin without need for implicitly loading it like pytest_plugins = 'aiohttp.pytest_plugin'.

Just run:

$ pip install pytest-aiohttp

and write tests with the plugin support:

from aiohttp import web

async def hello(request):
    return web.Response(body=b'Hello, world')

def create_app(loop):
    app = web.Application(loop=loop)
    app.router.add_route('GET', '/', hello)
    return app

async def test_hello(test_client):
    client = await test_client(create_app)
    resp = await client.get('/')
    assert resp.status == 200
    text = await resp.text()
    assert 'Hello, world' in text