Skip to main content

Pytest support for asyncio

Project description

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/main/graph/badge.svg Supported Python versions Matrix chat room: #pytest-asyncio

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

More details can be found in the documentation.

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.

Project details


Release history Release notifications | RSS feed

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-1.2.0.tar.gz (50.1 kB view details)

Uploaded Source

Built Distribution

pytest_asyncio-1.2.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file pytest_asyncio-1.2.0.tar.gz.

File metadata

  • Download URL: pytest_asyncio-1.2.0.tar.gz
  • Upload date:
  • Size: 50.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pytest_asyncio-1.2.0.tar.gz
Algorithm Hash digest
SHA256 c609a64a2a8768462d0c99811ddb8bd2583c33fd33cf7f21af1c142e824ffb57
MD5 f493266e3d161cd8409f28f1278cb5e1
BLAKE2b-256 42869e3c5f48f7b7b638b216e4b9e645f54d199d7abbbab7a64a13b4e12ba10f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_asyncio-1.2.0.tar.gz:

Publisher: main.yml on pytest-dev/pytest-asyncio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: pytest_asyncio-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pytest_asyncio-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8e17ae5e46d8e7efe51ab6494dd2010f4ca8dae51652aa3c8d55acf50bfb2e99
MD5 95689a5265103ac3a5b501874b8b44a8
BLAKE2b-256 04932fa34714b7a4ae72f2f8dad66ba17dd9a2c793220719e736dda28b7aec27

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_asyncio-1.2.0-py3-none-any.whl:

Publisher: main.yml on pytest-dev/pytest-asyncio

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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