Sourced from pytest-asyncio's releases.
pytest-asyncio 0.18.0
title: 'pytest-asyncio: pytest support for asyncio'
pytest-asyncio is an Apache2 licensed library, written in Python, for testing asyncio code with pytest.
asyncio code is usually written in the form of coroutines, which makes it slightly more difficult to test using normal testing tools. pytest-asyncio provides useful fixtures and markers to make testing easier.
@pytest.mark.asyncio async def test_some_asyncio_code(): res = await library.do_something() assert b"expected result" == res
pytest-asyncio has been strongly influenced by pytest-tornado.
Features
- fixtures for creating and injecting versions of the asyncio event loop
- fixtures for injecting unused tcp/udp ports
- pytest markers for treating tests as asyncio coroutines
- easy testing with non-default event loops
- support for [async def]{.title-ref} fixtures and async generator fixtures
- support auto mode to handle all async fixtures and tests automatically by asyncio; provide strict mode if a test suite should work with different async frameworks simultaneously, e.g.
asyncio
andtrio
.Installation
... (truncated)
07e9922
Prepare release of v0.18.0 (#282)a92d894
Relax dependency on typing-extensions (#284)e78b59d
Fix setuptools_scm configuration (#279)d8efa64
Support parametrized event_loop fixture (#278)dab3b51
Raise a warning if @​pytest
.mark.asyncio is applied to non-async function (#275)048a6ed
Code cleanup: drop 'request' argument from async fixtures (#270)4353327
Update changelogc919fd7
Remove unconditional test item attribute access (#268)39c6d0c
Update README547933d
Require typing-extensions on py<3.8 only (#269)