Registry / testing / pytest-aio

pytest-aio

JSON →
library2.1.7pypypi✓ verified 88d ago

Pytest plugin for testing async Python code. Provides fixtures and markers for running async tests with pytest. Supports asyncio, trio, and other async frameworks. Current version 2.1.7, released under Apache 2.0 license. Active development, weekly commits.

pip install pytest-aio
INSTALL
IMPORT
SIG · PYTEST-AIO
P
pytest-aio
testingpythonv2.1.7
Install
2.9s avg
Import
—
Disk
29MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v2.1.7 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 30.8MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 2.9s · import 0.000s · 31MB
29MB installed
● package 29MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pytest_aio
✓ import pytest_aio
No common wrong pattern; plugin auto-loads via conftest

Basic async test using pytest-aio. Mark test with @pytest.mark.asyncio.

# test_async.py import pytest @pytest.mark.asyncio async def test_async_example(): result = await some_async_function() assert result == expected_value
Debug
Known issues
gotchapytest-aio does not automatically detect async fixtures. Use @pytest.fixture with asyncio marker or use async def fixture (requires pytest-aio>=2.0).
fix
Upgrade to 2.x or mark async fixtures explicitly.
affects: <2.0.0
deprecatedThe @pytest.mark.asyncio marker is deprecated in pytest-aio 2.x; use 'async def' directly without marker.
fix
Remove marker and simply write 'async def test_async():'
affects: >=2.0.0
breakingBreaking change in 2.0: Removed support for Python <3.10. async fixtures now require pytest-aio 2.x.
fix
Ensure Python >=3.10 and update tests to remove markers.
affects: >=2.0.0
Errors
Common errors & fixes
ImportError: cannot import name 'asyncio' from 'pytest_aio'
Trying to import asyncio from pytest_aio incorrectly.
fix
Use 'import asyncio' directly (stdlib), not from pytest_aio.
TypeError: async def test() got an unexpected keyword argument 'loop'
Old code passing loop fixture to async test.
fix
Remove 'loop' argument; pytest-aio 2.x handles event loop automatically.
ModuleNotFoundError: No module named 'pytest_aio'
pytest-aio not installed or not in virtual environment.
fix
Run 'pip install pytest-aio' in your environment.
Upgrade
Version history
2.1.7latest on PyPI · released Feb 12, 2026
Audit
Dependencies
pytestrequiredPlugin requires pytest to work
pytest-asynciooptionalAlternative, but pytest-aio is standalone
Agent activity
6 hits · last 30 days
node
4
Resources
pytest-aio — pip install pytest-aio · libregistry