Skip to content

pytest-dev/pytest-asyncio

Folders and files

NameName
Last commit message
Last commit date
Jan 24, 2025
Feb 24, 2025
Feb 8, 2025
Jan 28, 2025
Jan 28, 2025
Oct 28, 2024
Sep 19, 2024
Feb 24, 2025
Aug 20, 2024
Jan 9, 2022
Jan 20, 2023
Sep 19, 2024
Dec 3, 2023
Jun 26, 2024
Jan 21, 2025
Oct 24, 2024
Oct 24, 2024

Repository files navigation

pytest-asyncio

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.