asynctest
Enhance the standard unittest package with features for testing asyncio libraries
Decision gist · record as of 2026-08-14
Yes, if you are testing asyncio code on Python 3.5 or later and need selector-specific mocking utilities. No, if you need active maintenance and bug fixes—the package is dormant and unlikely to receive updates. Verify that asynctest's feature set meets your needs before adopting.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.5 or later; targets the selector model and does not yet support Windows' proactor event loop.
- Low install friction with no runtime dependencies.
- Maintenance is dormant—last release was 2019-05-14 and no commits since 2024-04-22—so expect no active bug fixes or feature updates.
License · maintenance · safety
Apache 2 (permissive) — Licensed under Apache 2 (permissive), so you can use, modify, and distribute the package freely with minimal restrictions.
last release 2019-05-14 (2649 days) · last repo commit 2024-04-22 · 310 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 11,182,646 downloads/mo, #1,411 on PyPI
Alternatives
Verify before relying
pip install asynctest
import asynctest
import unittest
class MyAsyncTest(asynctest.TestCase):
async def test_async_function(self):
mock = asynctest.CoroutineMock()
await mock()
mock.assert_called_once()- Whether asynctest's selector-based approach remains compatible with modern Python asyncio implementations.
- Current community adoption and whether built-in async mock utilities have superseded asynctest's CoroutineMock for most use cases.
What it is and what it does
asynctest is a testing library that builds on Python's standard unittest module to reduce boilerplate when writing tests for asyncio code. It provides CoroutineMock objects that properly mock coroutine functions, a TestCase subclass that automatically manages event loops for each test, and utilities to mock file and socket objects for selector-based testing. The library also includes helpers to control loop timing and run timed events without wall-clock delays.
The package is dormant—its last release was in 2019 and it has received no commits since 2024-04-22. It supports Python 3.5 and later but currently targets the selector event loop model and does not support Windows' proactor. You should verify whether asynctest still adds value for your use case before adopting.
Use it for
- Mock coroutine functions in unit tests without manually wrapping them or managing their return values.
- Run async test methods and setUp/tearDown coroutines within a managed event loop per test.
- Control event loop timing in tests via ClockedTestCase to run timed callbacks without waiting for wall-clock time.
- Mock file and socket objects for testing selector-based I/O code without real network or filesystem calls.
- Patch async functions and generators with custom behavior using asynctest's patch decorators.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are testing asyncio code on Python 3.5 or later and need selector-specific mocking utilities.
No, if you need active maintenance and bug fixes—the package is dormant and unlikely to receive updates. Verify that asynctest's feature set meets your needs before adopting.
Install
asynctest on PyPI
Before you install
Low install friction with no runtime dependencies. Maintenance is dormant—last release was 2019-05-14 and no commits since 2024-04-22—so expect no active bug fixes or feature updates.
Requires Python 3.5 or later; targets the selector model and does not yet support Windows' proactor event loop.
License in practice
Licensed under Apache 2 (permissive), so you can use, modify, and distribute the package freely with minimal restrictions.
Quickstart
pip install asynctest
import asynctest
import unittest
class MyAsyncTest(asynctest.TestCase):
async def test_async_function(self):
mock = asynctest.CoroutineMock()
await mock()
mock.assert_called_once()
Verify before relying
- Whether asynctest's selector-based approach remains compatible with modern Python asyncio implementations.
- Current community adoption and whether built-in async mock utilities have superseded asynctest's CoroutineMock for most use cases.
Package facts
| License | Apache 2 permissive |
| Python support | Supports the current Python release >=3.5 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Dormant 2,649 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 11,182,646 / month, #1,411 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Testing |
Evidence: asynctest-0.13.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “coroutine mock”
- asynctestExtends Python's unittest module with test utilities and mocks…
- asyncmockProvides awaitable mock objects for testing async code, extending the…
- backports_abcProvides backports of abstract base classes (Generator, Coroutine,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also aiounittest · asyncmock · TestSlide · aioresponses · syncer · blockbuster · flexmock · nest-asyncio · aiodebug