aiounittest
Test asyncio code more easily.
What it is and what it does
aiounittest is a test helper library that extends unittest.TestCase to support testing asyncio code using async/await syntax. It lets you write test methods as async functions and run them within an event loop, while still supporting synchronous tests in the same class. The library also provides utilities like AsyncMockIterator for mocking async iterators and futurized mocks for coroutines.
The package is designed to bridge the gap between unittest and asyncio, making it easier to test asynchronous code without boilerplate. However, for Python 3.8 and newer, the standard library now includes unittest.IsolatedAsyncioTestCase, which provides built-in asyncio support and may be preferable for new projects targeting recent Python versions.
Use it for:
- Testing async functions and coroutines in projects targeting Python 3.4–3.7 before IsolatedAsyncioTestCase was available
- Writing mixed test suites with both synchronous and asynchronous test methods in a single class
- Mocking async iterators and coroutines using the library's AsyncMockIterator and futurized utilities
- Migrating legacy asyncio test code that predates Python 3.8's built-in async test support
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a test case class for writing unit tests of asyncio code using async/await syntax, alongside support for synchronous tests in the same suite.
Yes, but with conditions. Install if you are maintaining code on Python 3.4–3.7 or need to test asyncio code in an existing unittest suite. For new projects targeting Python 3.8+, prefer the standard library's unittest.IsolatedAsyncioTestCase instead. The package is stable and permissively licensed, but aging maintenance means it may not receive updates for new Python features.
Install
aiounittest on PyPI
pip
pip install aiounittestuv
uv add aiounittestpoetry
poetry add aiounittestInstalling aiounittest
Before you install
Low install friction with a single runtime dependency (wrapt). Maintenance status is aging—last release was 525 days ago, though the repository remains active with a recent commit on 2026-01-19. For Python 3.8+, the standard library's unittest.IsolatedAsyncioTestCase is now the recommended alternative.
License in practice
MIT license is permissive, allowing use in commercial and private projects with minimal restrictions beyond attribution.
Quickstart
pip install aiounittest
import asyncio
import aiounittest
class MyTest(aiounittest.AsyncTestCase):
async def test_async_add(self):
result = await asyncio.sleep(0.1)
self.assertEqual(result, None)
Verify before relying
- Whether wrapt dependency is required at runtime or only for specific features
- Current test coverage and whether the package is actively maintained despite aging status
- Performance characteristics compared to unittest.IsolatedAsyncioTestCase in Python 3.8+
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — wrapt |
| Maintenance | aging — 525 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 300,487/month — #7,841 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: aiounittest-1.5.0-py3-none-any.whl
Keywords: asyncio, async, unittest, coroutine
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
syncerSyncer converts async functions to synchronous…
permissive · top 15,000 on PyPI
asynctestExtends Python's unittest module with test…
permissive · top 5,000 on PyPI
synchronicityWraps async functions, generators, and classes…
permissive · top 1,000 on PyPI
aiointerceptIntercepts aiohttp client requests by routing…
permissive · top 15,000 on PyPI
threadloopRuns Tornado coroutines from synchronous Python…
permissive · top 15,000 on PyPI
asyncmockProvides awaitable mock objects for testing…
permissive · top 15,000 on PyPI
parametrizeProvides a `@parametrize` decorator that works…
permissive · top 15,000 on PyPI
TestSlideTestSlide is a test framework for Python that…
permissive · top 15,000 on PyPI
softestSoftest extends unittest.TestCase to allow…
unclear · top 15,000 on PyPI