aresponses
Asyncio response mocking. Similar to the responses library used for 'requests'
Decision gist · record as of 2026-08-14
Yes, if you write asyncio tests with aiohttp. It has low install friction, no known vulnerabilities, permissive licensing, and is stable and widely used despite dormant maintenance. The trade-off: the last release was over 945 days ago, so if you need fixes for new Python or aiohttp versions, you may need to fork or wait for a maintainer response. For active projects on current Python (3.7–3.12), it works as-is.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires pytest-asyncio to be installed and your test function decorated with @pytest.mark.asyncio; version 3.0.0 uses asyncio.get_running_loop() and may not work with older event loop patterns.
- Low friction: pure Python wheel with only two runtime dependencies (pytest-asyncio and aiohttp).
- Maintenance is dormant—last release was 2024-01-12, over 945 days ago, though the repository remains active and the package is widely used (115539 monthly downloads).
License · maintenance · safety
permissive license (permissive) — Licensed under MIT (permissive), so you can use it freely in commercial and private projects with minimal restrictions.
last release 2024-01-12 (945 days) · last repo commit 2024-07-11 · 107 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 115,539 downloads/mo, #12,245 on PyPI
Alternatives
Verify before relying
pip install aresponses
import aresponses
import aiohttp
import pytest
@pytest.mark.asyncio
async def test_mock(aresponses):
aresponses.add("example.com", "/api", "GET", response="OK")
async with aiohttp.ClientSession() as session:
async with session.get("http://example.com/api") as resp:
assert await resp.text() == "OK"
aresponses.assert_plan_strictly_followed()- Whether the dormant maintenance status (945 days since last release) poses a risk for future Python or aiohttp compatibility.
- Performance characteristics when mocking high-volume or complex request/response patterns.
- Compatibility with pytest-asyncio versions beyond what the fact sheet specifies.
What it is and what it does
aresponses is a test fixture and mock server for asyncio applications that use aiohttp. It intercepts HTTP and HTTPS requests made by aiohttp.ClientSession and returns predefined responses without touching the network. You define routes using pattern matching (exact strings or regular expressions) on host, path, method, and body, then attach responses—plain text, JSON dicts, custom Response objects, or callable handlers. When your test code makes a request, aresponses matches it to the first registered route, returns the response, and removes that route from the table.
The package is designed for pytest integration and requires explicit assertions at the end of each test to verify that routes were called in order, all routes were used, and no unmatched requests occurred. It supports regex patterns for flexible matching, repeated routes via the repeat parameter, JSON responses as a convenience, custom handler functions, and a passthrough mode to let specific requests reach the real network. Version 3.0.0 updated to use asyncio.get_running_loop() instead of the deprecated event_loop fixture pattern.
Use it for
- Unit test an async client library or service that calls external APIs without making real HTTP requests.
- Simulate error responses (500, timeouts, malformed JSON) to test error handling in async code.
- Mock multiple external services in a single test by registering different routes for different hosts.
- Verify that your async code calls external APIs in the correct order with the correct parameters.
- Test HTTPS requests by transparently converting them to HTTP mocks without certificate setup.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you write asyncio tests with aiohttp.
It has low install friction, no known vulnerabilities, permissive licensing, and is stable and widely used despite dormant maintenance. The trade-off: the last release was over 945 days ago, so if you need fixes for new Python or aiohttp versions, you may need to fork or wait for a maintainer response. For active projects on current Python (3.7–3.12), it works as-is.
Install
aresponses on PyPI
Before you install
Low friction: pure Python wheel with only two runtime dependencies (pytest-asyncio and aiohttp). Maintenance is dormant—last release was 2024-01-12, over 945 days ago, though the repository remains active and the package is widely used (115539 monthly downloads).
Requires pytest-asyncio to be installed and your test function decorated with @pytest.mark.asyncio; version 3.0.0 uses asyncio.get_running_loop() and may not work with older event loop patterns.
License in practice
Licensed under MIT (permissive), so you can use it freely in commercial and private projects with minimal restrictions.
Quickstart
pip install aresponses
import aresponses
import aiohttp
import pytest
@pytest.mark.asyncio
async def test_mock(aresponses):
aresponses.add("example.com", "/api", "GET", response="OK")
async with aiohttp.ClientSession() as session:
async with session.get("http://example.com/api") as resp:
assert await resp.text() == "OK"
aresponses.assert_plan_strictly_followed()
Verify before relying
- Whether the dormant maintenance status (945 days since last release) poses a risk for future Python or aiohttp compatibility.
- Performance characteristics when mocking high-volume or complex request/response patterns.
- Compatibility with pytest-asyncio versions beyond what the fact sheet specifies.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagespytest-asyncioaiohttp |
| Maintenance | Dormant 945 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 115,539 / month, #12,245 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: aresponses-3.0.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 › “asyncio http mocking”
- aresponsesMocks external HTTP/HTTPS services for asyncio-based tests by…
- aioresponsesMocks HTTP requests made by aiohttp's ClientSession for testing…
- mocketMocket is a socket mocking framework that intercepts and replaces…
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 aioresponses · aiosonic · aiointercept · sanic-testing · pytest-responses · urllib3-mock · responses · pytest-aiohttp · looptime · asyncmock