Skip to main content

Pytest support for asyncio

Reason this release was yanked:

v0.22.0 deprecated functionality, but didn't provide reasonable replacements for all relevant use cases. The release is yanked to avoid wasting people's time and pytest-asyncio is going back to the drawing board regarding the deprecations.

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 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

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-0.22.0.tar.gz (37.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-0.22.0-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytest-asyncio-0.22.0.tar.gz
  • Upload date:
  • Size: 37.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pytest-asyncio-0.22.0.tar.gz
Algorithm Hash digest
SHA256 01da1bf94ff0b969cc8d760104f7c1011903d0d658bdaef0bbae769660a7fbc4
MD5 15b2d55e459b99b9ef5c3a8000ea04e3
BLAKE2b-256 24056e2e679644466425126aeca57165723cdd56dfd1971c0aec4bc063ec0009

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytest_asyncio-0.22.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c09905acb3b79827aace4c67fe15097daea1b363c00c8236875395414914bad3
MD5 567eb0ac805818022afdaf7e2e03fca1
BLAKE2b-256 823fd0a76a3596d5e8dd42051db3fc7b09bcf901d409dddfe1a601299b5baec8

See more details on using hashes here.

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