sanic-testing
Core testing clients for Sanic
What it is and what it does
sanic-testing is a standalone test utility package extracted from Sanic core, providing both synchronous and asynchronous HTTP test clients for Sanic applications. It attaches itself to a Sanic instance via TestManager and exposes test_client (for sync tests) and asgi_client (for async tests) that can execute application handlers without standing up a server or making actual network calls.
The package depends on httpx for HTTP functionality and is designed to maintain API compatibility with the original sanic.testing module. It supports Python 3.8 through 3.12 and is classified as Beta. The async client is particularly useful for testing async handlers directly without server overhead.
Use it for:
- Write unit tests for Sanic route handlers using synchronous test_client to verify responses and status codes
- Test async Sanic handlers with asgi_client in pytest-asyncio to execute application logic in-process
- Migrate existing Sanic tests from the deprecated sanic.testing module to this standalone package
- Verify request/response behavior for Sanic middleware and error handlers without network calls
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides sync and async test clients for testing Sanic web applications without requiring a running server.
Yes, if you are testing Sanic applications. The package is stable (Beta, no known vulnerabilities) and has low install friction. However, note that maintenance is dormant—last release was 775 days ago—so verify compatibility with your Sanic version before adopting. It is the intended successor to sanic.testing and remains the standard testing tool for Sanic.
Install
sanic-testing on PyPI
pip
pip install sanic-testinguv
uv add sanic-testingpoetry
poetry add sanic-testingInstalling sanic-testing
Before you install
Low install friction with a single runtime dependency (httpx). Maintenance is dormant—last release was 775 days ago—but the repository remains active and the package is marked Beta. Use with awareness that updates may be infrequent.
License in practice
MIT license is permissive; you can use this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install sanic-testing
from sanic import Sanic
from sanic_testing import TestManager
sanic_app = Sanic(__name__)
TestManager(sanic_app)
# Now use app.test_client or app.asgi_client in tests
Verify before relying
- Whether the package remains compatible with recent Sanic versions given the dormant maintenance status
- Whether pytest-asyncio is required as a runtime dependency or only for async test examples
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — httpx |
| Maintenance | dormant — 775 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 220,767/month — #9,292 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sanic_testing-24.6.0-py3-none-any.whl
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
sanicSanic is an async Python web framework and…
permissive · top 5,000 on PyPI
aresponsesMocks external HTTP/HTTPS services for…
permissive · top 15,000 on PyPI
smithy-httpProvides HTTP primitives, interfaces, and…
permissive · top 15,000 on PyPI
oidc-provider-mockA mock OpenID Connect provider server that runs…
permissive · top 15,000 on PyPI
pytest-tornadoA pytest plugin that provides fixtures and…
permissive · top 15,000 on PyPI
sanic-jwtSanic JWT adds JWT-based authentication and…
permissive · top 15,000 on PyPI
Sanic-CorsSanic-CORS is a Sanic extension that adds…
permissive · top 15,000 on PyPI
async-asgi-testclientProvides an async test client for ASGI web…
permissive · top 15,000 on PyPI
sanic-extSanic Extensions adds OpenAPI documentation,…
permissive · top 15,000 on PyPI
smithy-coreProvides core Python interfaces and components…
permissive · top 15,000 on PyPI