Skip to main content

Async client for testing ASGI web applications

Project description


Build Status PyPI version

Async ASGI TestClient is a library for testing web applications that implements ASGI specification (version 2 and 3).

The motivation behind this project is building a common testing library that doesn't depend on the web framework (Quart, Startlette, ...), the same way people are doing ASGI servers like uvicorn or hypercorn that doesn't depend on the framework.

This library is based on the testing module provided in Quart.


Requirements: Python 3.6+


pip install async-asgi-testclient


from quart import Quart, jsonify

app = Quart(__name__)

async def root():
    return "plain response"

async def json():
    return jsonify({"hello": "world"})

if __name__ == '__main__':

from async_asgi_testclient import TestClient

import pytest

async def test_quart_app():
    from .my_api import app

    async with TestClient(app) as client:
        resp = await client.get("/")
        assert resp.status_code == 200
        assert resp.text == "plain response"

        resp = await client.get("/json")
        assert resp.status_code == 200
        assert resp.json() == {"hello": "world"}


  • [X] cookies
  • [X] follow redirects
  • [X] response streams
  • [X] request streams
  • [X] websocket support

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
async-asgi-testclient-1.0.3.tar.gz (21.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page