skillfed

sanic-testing

Core testing clients for Sanic

sanic-testing v24.6.0 220.8K downloads/30d#9,292 on PyPI36
Permissive license MIT DORMANT released

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-testing

uv

uv add sanic-testing

poetry

poetry add sanic-testing

Installing 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

Development Status :: 4 - BetaEnvironment :: Web EnvironmentLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

sanic testing clienttest sanic applicationsasync http test clientsanic unit testingweb framework testingsanic asgi clienthttp request testing
sanic-frameworkhttp-testingasync-support

More Testing packages