aiointercept
aiohttp mock library that routes requests through a real test server
Decision gist · record as of 2026-08-14
Yes. It fills a real gap between pure mocking (fast but unrealistic) and hitting real servers (slow and fragile). Low install friction, no security issues, active maintenance, and MIT licensing make it a safe choice for async HTTP testing.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python ≥3.10 and aiohttp ≥3.13
- Low friction: pure Python wheel with three stable runtime dependencies (aiohttp, multidict, yarl).
- Actively maintained with recent release and commits through 2026-08-12.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open and closed projects with minimal attribution requirements.
last release 2026-07-08 (37 days) · last repo commit 2026-08-12 · 9 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 109,210 downloads/mo, #12,526 on PyPI
Alternatives
Verify before relying
pip install aiointercept
import aiohttp
from aiointercept import aiointercept
async with aiointercept() as m:
m.get(f"{m.server_url}/users", payload=[{"id": 1}])
async with aiohttp.ClientSession() as session:
resp = await session.get(f"{m.server_url}/users")
assert await resp.json() == [{"id": 1}]- Whether pytest-asyncio is required or optional for the aiointercept_mock fixture
- Performance characteristics when intercepting high-volume or large-payload requests
- Compatibility with aiohttp versions older than 3.13
What it is and what it does
aiointercept is a testing library that mocks aiohttp HTTP requests by starting a real aiohttp.web server and routing client requests to it instead of replacing them with fake objects. Unlike pure mocking libraries, your code runs its full HTTP stack—serialization, header handling, content-type negotiation—but the remote endpoint is replaced with a local test server. You register responses by URL pattern and receive real aiohttp.web.Request objects in callbacks, letting you inspect what the client actually sent. It supports both direct URL redirection and transparent DNS interception for hardcoded URLs.
The library ships with a pytest plugin that runs a session-scoped server and provides the aiointercept_mock fixture, clearing registered handlers between tests to prevent leakage. It aims for API compatibility with aioresponses, making it a near drop-in replacement for existing test suites. Requires Python ≥3.10 and aiohttp ≥3.13.
Use it for
- Test async code that makes HTTP requests without hitting real servers or mocking the socket layer
- Verify that your client correctly serializes headers, bodies, and query parameters through the full aiohttp stack
- Intercept and inspect requests in callbacks to assert on what the client actually sent
- Run integration tests with a session-scoped server via pytest fixture to avoid per-test startup overhead
- Migrate from aioresponses while keeping most of your test code unchanged
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
It fills a real gap between pure mocking (fast but unrealistic) and hitting real servers (slow and fragile). Low install friction, no security issues, active maintenance, and MIT licensing make it a safe choice for async HTTP testing.
Install
aiointercept on PyPI
Before you install
Low friction: pure Python wheel with three stable runtime dependencies (aiohttp, multidict, yarl). Actively maintained with recent release and commits through 2026-08-12.
Requires Python ≥3.10 and aiohttp ≥3.13
License in practice
MIT license permits unrestricted use, modification, and distribution in both open and closed projects with minimal attribution requirements.
Quickstart
pip install aiointercept
import aiohttp
from aiointercept import aiointercept
async with aiointercept() as m:
m.get(f"{m.server_url}/users", payload=[{"id": 1}])
async with aiohttp.ClientSession() as session:
resp = await session.get(f"{m.server_url}/users")
assert await resp.json() == [{"id": 1}]
Verify before relying
- Whether pytest-asyncio is required or optional for the aiointercept_mock fixture
- Performance characteristics when intercepting high-volume or large-payload requests
- Compatibility with aiohttp versions older than 3.13
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagesaiohttpmultidictyarl |
| Maintenance | Actively maintained 37 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 109,210 / month, #12,526 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaFramework :: AsyncIOFramework :: PytestFramework :: aiohttpIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Topic :: Software Development :: TestingTopic :: Software Development :: Testing :: MockingTyping :: Typed |
Evidence: aiointercept-0.1.9-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 › “aiohttp mock testing”
- aiointerceptIntercepts aiohttp client requests by routing them through a real…
- aioresponsesMocks HTTP requests made by aiohttp's ClientSession for testing…
- aresponsesMocks external HTTP/HTTPS services for asyncio-based tests by…
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 · httmock · aresponses · mocket · wiremock · requests-mock · pook · responses · pytest-aiohttp · aiohttp