skillfed

starlette-testclient

A backport of Starlette TestClient using requests! ⏪️

starlette-testclient v0.4.1 2.8M downloads/30d#2,906 on PyPI
Permissive license DORMANT released

What it is and what it does

starlette-testclient is a backport of Starlette's TestClient that swaps out httpx for requests as the underlying HTTP library. It exists as a migration aid: if your codebase still uses requests for testing and you're not ready to switch to httpx, this package lets you keep that pattern without forking Starlette's test utilities. You import from starlette_testclient instead of starlette.testclient and get the same TestClient interface backed by requests.

The package depends on requests and starlette as runtime libraries and supports Python 3.7 through 3.12. It is classified as Alpha and has not been actively maintained for over two years, so it functions as a compatibility shim rather than an evolving tool. No known security vulnerabilities are recorded.

Use it for:

  • Testing applications in codebases that standardize on requests and cannot yet migrate to httpx.
  • Gradual migration: use this backport while transitioning test suites from requests to httpx-based clients.
  • Legacy projects: maintain existing test patterns in older applications without rewriting test infrastructure.
  • Minimal dependency footprint: avoid adding httpx to projects that already have requests as a core dependency.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides a drop-in replacement for Starlette's TestClient that uses requests instead of httpx for testing Starlette applications.

Yes, if you are actively migrating away from this package or need a temporary requests-based TestClient for an existing codebase. No, if you are starting a new project—use the native httpx-based TestClient instead. The dormant maintenance status means this is a bridge tool, not a long-term solution; plan to migrate to the standard TestClient.

Install

starlette-testclient on PyPI

pip

pip install starlette-testclient

uv

uv add starlette-testclient

poetry

poetry add starlette-testclient

Installing starlette-testclient

Before you install

Low friction: pure Python wheel with only two runtime dependencies (requests and starlette). Maintenance is dormant—last release was 837 days ago—so expect no active updates or bug fixes.

License in practice

BSD 3-Clause permissive license means you can use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions.

Quickstart

pip install starlette-testclient

from starlette_testclient import TestClient

Verify before relying

  • Whether this backport remains compatible with current starlette versions beyond the last release date.
  • Whether requests-based testing covers all httpx-specific behaviors needed for comprehensive testing.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies 2 — requests, starlette
Maintenance dormant — 837 days since the last release
First released
Downloads 2,751,808/month — #2,906 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: starlette_testclient-0.4.1-py3-none-any.whl

Development Status :: 3 - AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

starlette testing with requeststestclient requests backportstarlette app testinghttp client testing starlettestarlette test utilitiesrequests-based test clienttestclient migration
starlettetestingmigration-aid

More Testing packages

pluggy

Pluggy provides a plugin system that lets you…

permissive · top 100 on PyPI

pytest

pytest is a testing framework that lets you…

permissive · top 100 on PyPI

virtualenv

virtualenv creates isolated Python environments…

permissive · top 100 on PyPI

coverage

Coverage.py measures which lines of Python code…

permissive · top 1,000 on PyPI

pytest-asyncio

pytest-asyncio is a pytest plugin that enables…

permissive · top 1,000 on PyPI

pytest-json-ctrf

A pytest plugin that generates test reports in…

permissive · top 1,000 on PyPI

async-asgi-testclient

Provides an async test client for ASGI web…

permissive · top 15,000 on PyPI

starlette

Starlette is a lightweight ASGI framework for…

permissive · top 100 on PyPI

aiohttp-asgi-connector

Provides an AIOHTTP connector that lets you…

permissive · top 15,000 on PyPI

apimatic-requests-client-adapter

Provides a requests-based HTTP client adapter…

permissive · top 15,000 on PyPI

starlette-cramjam

Middleware for Starlette that compresses HTTP…

permissive · top 15,000 on PyPI

starlette-prometheus

Adds Prometheus metrics collection and exposure…

copyleft · top 15,000 on PyPI

opentelemetry-instrumentation-starlette

Adds automatic tracing and observability…

permissive · top 5,000 on PyPI

starlette-context

Middleware for Starlette that stores and…

permissive · top 5,000 on PyPI

Secweb

Secweb applies security headers (CSP, HSTS,…

copyleft · top 15,000 on PyPI

niquests

Niquests is a drop-in replacement for Requests…

permissive · top 5,000 on PyPI