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.3.0.tar.gz (50.1 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-1.3.0-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytest_asyncio-1.3.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.3.0.tar.gz
Algorithm Hash digest
SHA256 d7f52f36d231b80ee124cd216ffb19369aa168fc10095013c6b014a34d3ee9e5
MD5 f9bf0eed023c7b6bb1d68ebea82d0398
BLAKE2b-256 902c8af215c0f776415f3590cac4f9086ccefd6fd463befeae41cd4d3f193e5a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_asyncio-1.3.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.3.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_asyncio-1.3.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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 611e26147c7f77640e6d0a92a38ed17c3e9848063698d5c93d5aa7aa11cebff5
MD5 02728221b99001f0f224b438774af91f
BLAKE2b-256 e535f8b19922b6a25bc0880171a2f1a003eaeb93657475193ab516fd87cac9da

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_asyncio-1.3.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 Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page