skillfed

pytest-httpx

Send responses to httpx.

pytest-httpx Permissive license MIT License Copyright (c) 2026 Colin Bounouar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) Active 454 v0.36.2 released

Install

pytest-httpx on PyPI

pip

pip install pytest-httpx

uv

uv add pytest-httpx

poetry

poetry add pytest-httpx

Package facts

License MIT License Copyright (c) 2026 Colin Bounouar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 2 — httpx, pytest
Maintenance actively maintained — 126 days since the last release
Last repo commit
First released
Popularity one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13)
Known vulnerabilities none known (OSV.dev, checked 2026-08-13)

Evidence: pytest_httpx-0.36.2-py3-none-any.whl

Keywords: httpx, pytest, testing

Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Internet :: WWW/HTTPTopic :: Software Development :: Build ToolsTyping :: Typed

About pytest-httpx

from the package's own PyPI description — quoted content, verbatim

<h2 align="center">Send responses to HTTPX using pytest</h2>

<p align="center"> <a href="https://pypi.org/project/pytest-httpx/"><img alt="pypi version" src="https://img.shields.io/pypi/v/pytest_httpx"></a> <a href="https://github.com/Colin-b/pytest_httpx/actions"><img alt="Build status" src="https://github.com/Colin-b/pytest_httpx/workflows/Release/badge.svg"></a> <a href="https://github.com/Colin-b/pytest_httpx/actions"><img alt="Coverage" src="https://img.shields.io/badge/coverage-100%25-brightgreen"></a> <a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a> <a href="https://github.com/Colin-b/pytest_httpx/actions"><img alt="Number of tests" src="https://img.shields.io/badge/tests-298 passed-blue"></a> <a href="https://pypi.org/project/pytest-httpx/"><img alt="Number of downloads" src="https://img.shields.io/pypi/dm/pytest_httpx"></a> </p>

> [!NOTE]
> Version 1.0.0 will be released once httpx is considered as stable (release of 1.0.0). > > However, current state can be considered as stable.

Once installed, httpx_mock pytest fixture will make sure...

Read as markdown · JSON record · Source repository · Docs

AI interpretation — verify before relying

AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page

A pytest fixture that mocks httpx HTTP requests and responses during testing, allowing you to define and verify request/response behavior without hitting real endpoints.

Low friction install with only two runtime dependencies (httpx and pytest). Actively maintained with recent release (126 days ago) and 454 repository stars; 100% test coverage and 298 passing tests indicate solid reliability.

MIT License permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and proprietary projects.

Usage

pip install pytest-httpx

import httpx
import pytest

def test_mock(httpx_mock):
    httpx_mock.add_response()
    with httpx.Client() as client:
        response = client.get("https://example.com")

Requires Python 3.10 or later.

Verdict: Stable, well-maintained testing utility for httpx with permissive MIT licensing and no known vulnerabilities. Suitable for projects that need to mock HTTP interactions in pytest; active development and high test coverage provide confidence in reliability.

Needs verification

  • Whether the package supports all httpx client features (streaming, proxies, custom auth) in mocking scenarios.
  • Performance characteristics when mocking large numbers of requests or complex response matching patterns.
mock httpx requests pytesthttpx testing fixturepytest http client mockinghttpx response stubbingtest httpx without networkhttpx request matchingasync http mocking pytest

Similar packages