skillfed

pytest-aio

Pytest plugin for testing async python code

pytest-aio v2.1.7 77.9K downloads/30d#14,483 on PyPI15
Permissive license MIT AGING released

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-aio

uv

uv add pytest-aio

poetry

poetry add pytest-aio

Installing 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

Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Testing

Tags

pytest async test pluginrun async tests with pytestasyncio trio curio testingpytest async fixturesasync test runner
async-testingpytest-pluginmulti-backend

More Testing packages