pytest-aio
Pytest plugin for testing async python code
What it is and what it does
pytest-aio is a pytest plugin that detects and runs async test functions and fixtures without requiring explicit markers or decorators. It supports asyncio, trio, and curio as async backends, automatically parametrizing tests across all installed backends by default. The plugin handles contextvars correctly for both async and sync fixtures, and includes a helper fixture (aiosleep) that abstracts over the sleep function of whichever backend is currently running.
You install it alongside pytest and write async test functions as you normally would; the plugin intercepts them at collection time and runs them through the appropriate event loop. You can customize which backends run globally via a fixture override, or mark individual tests to run on specific backends. It's designed for straightforward async testing without boilerplate.
Use it for:
- Testing asyncio-based applications without writing wrapper functions or using pytest-asyncio decorators
- Running the same test suite against multiple async backends (asyncio, trio, curio) to verify compatibility
- Using async fixtures in sync tests by including the aiolib fixture to manage the event loop lifecycle
- Testing trio-asyncio interop code by parametrizing the aiolib fixture with trio+asyncio configuration
- Verifying async code with custom event loop factories (e.g., uvloop) by passing backend options
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A pytest plugin that automatically runs async test functions and fixtures without requiring special markers, supporting asyncio, trio, and curio backends.
Yes. It is a lightweight, permissively licensed plugin with no security vulnerabilities, low install friction, and straightforward async test support. The aging maintenance status is not a blocker—the codebase is stable and the repo remains active. Install it if you need to test async Python code with pytest and want to avoid boilerplate or test across multiple async backends.
Install
pytest-aio on PyPI
pip
pip install pytest-aiouv
uv add pytest-aiopoetry
poetry add pytest-aioInstalling pytest-aio
Before you install
Low friction—pure Python wheel with only pytest as a runtime dependency. Maintenance is aging (183 days since last release), but the repo remains active and the project is marked Production/Stable.
License in practice
MIT license (permissive) places no restrictions on use, modification, or distribution in proprietary or open-source contexts.
Quickstart
pip install pytest-aio
# In your test file:
async def test_async():
assert True
# Run with pytest as normal
# pytest will automatically run the async test
Requires Python >= 3.10
Verify before relying
- Whether the plugin's automatic backend selection (asyncio, trio, curio by default) covers all common async testing scenarios without configuration
- Performance characteristics when running large test suites across multiple backends
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (<4,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pytest |
| Maintenance | aging — 183 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 77,898/month — #14,483 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_aio-2.1.7-py3-none-any.whl
Keywords: asyncio, curio, pytest, trio
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
pytest-trioA pytest plugin that enables testing of async…
permissive · top 15,000 on PyPI
async_generatorProvides async generators and async context…
permissive · top 5,000 on PyPI
pytest-tornadoA pytest plugin that provides fixtures and…
permissive · top 15,000 on PyPI
pytest-tornasyncA pytest plugin that runs native async test…
permissive · top 15,000 on PyPI
rtestA Python test runner built in Rust that uses…
permissive · top 15,000 on PyPI
aiologicaiologic provides thread-aware and async-aware…
permissive · top 5,000 on PyPI
pytest-redisA pytest plugin that provides fixtures for…
copyleft · top 15,000 on PyPI
pytest-dockerpytest-docker provides pytest fixtures that…
permissive · top 5,000 on PyPI
pytest-rabbitmqA pytest plugin that provides fixtures to start…
copyleft · top 15,000 on PyPI
pytest-operatorA pytest plugin that provides fixtures and…
permissive · top 15,000 on PyPI