ppc64le/linux/: pytest-aiohttp-1.0.5 metadata and description

Homepage Simple index

Pytest plugin for aiohttp support

classifiers
  • Development Status :: 4 - Beta
  • Intended Audience :: Developers
  • License :: OSI Approved :: Apache Software License
  • Programming Language :: Python :: 3.7
  • Programming Language :: Python :: 3.8
  • Programming Language :: Python :: 3.9
  • Programming Language :: Python :: 3.10
  • Topic :: Software Development :: Testing
  • Framework :: AsyncIO
  • Framework :: Pytest
  • Framework :: aiohttp
  • Typing :: Typed
  • Environment :: MetaData :: IBM Python Ecosystem
description_content_type text/x-rst
dynamic license-file
license Apache 2.0
license_file LICENSE
maintainer aiohttp team <[email protected]>
maintainer_email [email protected]
project_urls
  • GitHub, https://github.com/aio-libs/pytest-aiohttp
  • Changelog, https://github.com/aio-libs/pytest-aiohttp/blob/master/CHANGES.rst
provides_extras testing
requires_dist
  • pytest>=6.1.0
  • aiohttp>=3.8.1
  • pytest-asyncio>=0.17.2
  • coverage==6.2; extra == "testing"
  • mypy==0.931; extra == "testing"
requires_python >=3.7
File Tox results History
pytest_aiohttp-1.0.5-py3-none-any.whl
Size
10 KB
Type
Python Wheel
Python
3

pytest plugin for aiohttp support

The library provides useful fixtures for creation test aiohttp server and client.

Installation

$ pip install pytest-aiohttp

Add asyncio_mode = auto line to pytest configuration (see pytest-asyncio modes for details). The plugin works with strict mode also.

Usage

Write tests in pytest-asyncio style using provided fixtures for aiohttp test server and client creation. The plugin provides resources cleanup out-of-the-box.

The simple usage example:

from aiohttp import web


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


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


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

See aiohttp documentation <https://docs.aiohttp.org/en/stable/testing.html#pytest> for more details about fixtures usage.