
Research
/Security News
Fake imToken Chrome Extension Steals Seed Phrases via Phishing Redirects
Mixed-script homoglyphs and a lookalike domain mimic imToken’s import flow to capture mnemonics and private keys.
sanic-testing
Advanced tools
This package is meant to be the core testing utility and clients for testing Sanic applications. It is mainly derived from sanic.testing which has (or will be) removed from the main Sanic repository in the future.
pip install sanic-testing
The package is meant to create an almost seemless transition. Therefore, after loading the package, it will attach itself to your Sanic instance and insert test clients.
from sanic import Sanic
from sanic_testing import TestManager
sanic_app = Sanic(__name__)
TestManager(sanic_app)
This will provide access to both the sync (sanic.test_client) and async (sanic.asgi_client) clients. Both of these clients are also available directly on the TestManager instance.
Testing should be pretty much the same as when the test client was inside Sanic core. The difference is just that you need to run TestManager.
import pytest
@pytest.fixture
def app():
sanic_app = Sanic(__name__)
TestManager(sanic_app)
@sanic_app.get("/")
def basic(request):
return response.text("foo")
return sanic_app
def test_basic_test_client(app):
request, response = app.test_client.get("/")
assert response.body == b"foo"
assert response.status == 200
Testing of an async method is best done with pytest-asyncio installed. Again, the following test should look familiar to anyone that has used asgi_client in the Sanic core package before.
The main benefit of using the asgi_client is that it is able to reach inside your application, and execute your handlers without ever having to stand up a server or make a network call.
import pytest
@pytest.fixture
def app():
sanic_app = Sanic(__name__)
TestManager(sanic_app)
@sanic_app.get("/")
def basic(request):
return response.text("foo")
return sanic_app
@pytest.mark.asyncio
async def test_basic_asgi_client(app):
request, response = await app.asgi_client.get("/")
assert response.body == b"foo"
assert response.status == 200
FAQs
Core testing clients for Sanic
We found that sanic-testing demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Mixed-script homoglyphs and a lookalike domain mimic imToken’s import flow to capture mnemonics and private keys.

Security News
Latio’s 2026 report recognizes Socket as a Supply Chain Innovator and highlights our work in 0-day malware detection, SCA, and auto-patching.

Company News
Join Socket for live demos, rooftop happy hours, and one-on-one meetings during BSidesSF and RSA 2026 in San Francisco.