Pytest support for asyncio
Project description
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
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
Built Distribution
Hashes for pytest_asyncio-0.20.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f129998b209d04fcc65c96fc85c11e5316738358909a8399e93be553d7656442 |
|
MD5 | 5c1a0c48907ab75f3944101640d54f5a |
|
BLAKE2b-256 | 45749421cfde8def10c265b4f9ae19c95b8f4dc227f639cb8b89287d4946ac97 |