skillfed

aiounittest

Test asyncio code more easily.

aiounittest v1.5.0 300.5K downloads/30d#7,841 on PyPI58
Permissive license MIT AGING released

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 aiounittest

uv

uv add aiounittest

poetry

poetry add aiounittest

Installing 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

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

asyncio unit testingasync test frameworktest async codeasyncio test casecoroutine testingasync await testingunittest asyncio
asynciotestinglegacy-support

More Testing packages