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

Uploaded Source

Built Distribution

pytest_asyncio-1.1.0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pytest_asyncio-1.1.0.tar.gz
Algorithm Hash digest
SHA256 796aa822981e01b68c12e4827b8697108f7205020f24b5793b3c41555dab68ea
MD5 ff6ae26dc96e33ff84431b397ad45949
BLAKE2b-256 4e51f8794af39eeb870e87a8c8068642fc07bce0c854d6865d7dd0f2a9d338c2

See more details on using hashes here.

Provenance

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

File metadata

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

File hashes

Hashes for pytest_asyncio-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5fe2d69607b0bd75c656d1211f969cadba035030156745ee09e7d71740e58ecf
MD5 5f0a021125ff1ee7c69f650eb60a7705
BLAKE2b-256 c79dbf86eddabf8c6c9cb1ea9a869d6873b46f105a5d292d3a6f7071f5b07935

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_asyncio-1.1.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