--- id: pytest-trio version: "0.8.0" license: MIT OR Apache-2.0 license_treatment: permissive maintenance: aging --- # pytest-trio — Pytest plugin for trio License: permissive · Maintenance: aging · Downloads: 394.5K/mo ## What it is and what it does pytest-trio is a pytest plugin that bridges the gap between pytest's synchronous test runner and Trio's async I/O library. It lets you write test functions as async coroutines and run them directly under pytest, handling the event loop setup and teardown automatically. The plugin depends on trio, outcome, and pytest. The package is designed for projects already using Trio for concurrency and async I/O. Instead of writing wrapper functions or manually managing the event loop in tests, you mark async test functions with @pytest.mark.trio and pytest-trio runs them in a Trio context. It integrates with pytest's fixture system and supports Hypothesis for property-based testing of async code. Use it for: - Write async unit tests for Trio-based libraries without manual event loop management. - Test concurrent I/O operations and async functions in isolation using pytest fixtures. - Run property-based tests on async code via Hypothesis integration. - Validate error handling and cancellation behavior in async Trio applications. - Integrate async testing into existing pytest test suites without restructuring. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. A pytest plugin that enables testing of async code written with Trio, allowing you to write and run async test functions directly within pytest. Yes, if you are testing Trio-based code. The plugin is stable, well-integrated with pytest, and carries no security vulnerabilities. The aging maintenance (last release November 2022) is a minor concern but not a blocker—the project remains unarchived and the core functionality is mature. Install it as a dev dependency for any project using Trio. ## Install pip install pytest-trio uv add pytest-trio poetry add pytest-trio ## Installing pytest-trio Before you install: Low install friction with a pure-Python wheel. Maintenance is aging—last release was in November 2022 and no commits since October 2025—but the repository remains active and unarchived, suggesting the project is stable rather than abandoned. License in practice: Licensed under MIT or Apache 2.0 at your choice, both permissive licenses with no restrictions on commercial or private use. Quickstart: pip install pytest-trio import trio import pytest @pytest.mark.trio async def test_example(): await trio.sleep(0) Requires Python 3.7 or later; Trio must be installed as a runtime dependency. Verify before relying: - Whether the aging maintenance status (last release Nov 2022) affects compatibility with recent Trio or pytest versions. - Current test coverage and whether the plugin handles all Trio cancellation and timeout patterns. ## Package facts - License: MIT OR Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 394.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags pytest async testing, trio test plugin, async pytest fixtures, concurrent testing framework, trio async testing, pytest trio integration, async io testing, async-testing, trio-integration [View on SkillFed](https://skillfed.io/packages/pytest-trio) · [View on PyPI](https://pypi.org/project/pytest-trio/)