Skip to main content
https://img.shields.io/pypi/v/pytest-asyncio.svg https://github.com/pytest-dev/pytest-asyncio/workflows/CI/badge.svg https://codecov.io/gh/pytest-dev/pytest-asyncio/branch/master/graph/badge.svg Supported Python versions https://img.shields.io/badge/code%20style-black-000000.svg

pytest-asyncio is a pytest plugin. It facilitates testing of code that uses the asyncio library.

Specifically, pytest-asyncio provides support for coroutines as test functions. This allows users to await code inside their tests. For example, the following code is executed as a test item by pytest:

@pytest.mark.asyncio
async def test_some_asyncio_code():
    res = await library.do_something()
    assert b"expected result" == res

Note that test classes subclassing the standard unittest library are not supported. Users are advised to use unittest.IsolatedAsyncioTestCase or an async framework such as asynctest.

pytest-asyncio is available under the Apache License 2.0.

Installation

To install pytest-asyncio, simply:

$ pip install pytest-asyncio

This is enough for pytest to pick up pytest-asyncio.

Contributing

Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-asyncio-0.20.3.tar.gz (28.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_asyncio-0.20.3-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file pytest-asyncio-0.20.3.tar.gz.

File metadata

  • Download URL: pytest-asyncio-0.20.3.tar.gz
  • Upload date:
  • Size: 28.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.16

File hashes

Hashes for pytest-asyncio-0.20.3.tar.gz
Algorithm Hash digest
SHA256 83cbf01169ce3e8eb71c6c278ccb0574d1a7a3bb8eaaf5e50e0ad342afb33b36
MD5 dce438c7b0081d7f580b5a79d7105570
BLAKE2b-256 6e0638b0ca5d53582bb49697626975b5540435ea064762d852b5c66646c729e9

See more details on using hashes here.

File details

Details for the file pytest_asyncio-0.20.3-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_asyncio-0.20.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f129998b209d04fcc65c96fc85c11e5316738358909a8399e93be553d7656442
MD5 5c1a0c48907ab75f3944101640d54f5a
BLAKE2b-256 45749421cfde8def10c265b4f9ae19c95b8f4dc227f639cb8b89287d4946ac97

See more details on using hashes here.

Release history Release notifications | RSS feed

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page