$npx skillfedfor your agent

pytest-httpx2

A pytest plugin for mocking out httpx2 using respx.

With conditionsPyPI TestingReleased May 2026140.9K downloads / moBSD-3-ClausePure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — pytest_httpx2-1.0.0-py3-none-any.whl
v1.0.0 · released 2026-05-20 · Python >=3.10 · 1 runtime deps: respx

Yes, if you use httpx2 in your project and need to test code that makes HTTP calls. The plugin is lightweight, actively maintained, has no known vulnerabilities, and integrates cleanly into pytest's fixture model. Install it alongside your test dependencies.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.10 or later.
  • Low friction install with a single runtime dependency (respx).
  • The package is actively maintained with recent releases and a non-archived repository.

License · maintenance · safety

BSD-3-Clause (permissive) — BSD-3-Clause is permissive; you can use this in commercial and private projects with minimal restrictions.

last release 2026-05-20 (86 days) · last repo commit 2026-05-22 · 19 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 140,866 downloads/mo, #11,261 on PyPI

Verify before relying

pip install pytest-httpx2

import httpx2

def test_example(httpx2_mock):
    httpx2_mock.post("https://example.com/api").respond(201)
    response = httpx2.post("https://example.com/api")
    assert response.status_code == 201
  • Whether httpx2 is a stable, widely-used HTTP client or a newer/experimental library.
  • How respx's mocking approach compares to other httpx mocking strategies in the ecosystem.
Same gist for agents: .md · .json

What it is and what it does

pytest-httpx2 is a pytest plugin that intercepts httpx2 HTTP calls during tests and replaces them with mocked responses defined via respx. Instead of your tests making real network requests, you register expected request patterns and specify what response each should return; the plugin then routes matching calls to those mocks. It integrates directly into pytest's fixture system, injecting a respx.Router as the httpx2_mock fixture that you use to set up your mock responses.

The plugin supports both inline fixture configuration (passing the router directly to your test function) and pytest marker-based configuration via @pytest.mark.httpx2, which lets you set a base URL and other options declaratively. It has a single runtime dependency on respx and requires Python 3.10 or later.

Use it for

  • Unit test an API client that uses httpx2 without making real network calls or hitting external services.
  • Test error handling by mocking specific HTTP status codes and response bodies from an API.
  • Verify that your code constructs the correct request (method, URL, headers, body) before sending it.
  • Run tests in CI/CD environments where network access is restricted or unreliable.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you use httpx2 in your project and need to test code that makes HTTP calls.

The plugin is lightweight, actively maintained, has no known vulnerabilities, and integrates cleanly into pytest's fixture model. Install it alongside your test dependencies.

Install

pytest-httpx2 on PyPI

Before you install

Low friction install with a single runtime dependency (respx). The package is actively maintained with recent releases and a non-archived repository.

Requires Python 3.10 or later.

License in practice

BSD-3-Clause is permissive; you can use this in commercial and private projects with minimal restrictions.

Quickstart

pip install pytest-httpx2

import httpx2

def test_example(httpx2_mock):
    httpx2_mock.post("https://example.com/api").respond(201)
    response = httpx2.post("https://example.com/api")
    assert response.status_code == 201

Verify before relying

  • Whether httpx2 is a stable, widely-used HTTP client or a newer/experimental library.
  • How respx's mocking approach compares to other httpx mocking strategies in the ecosystem.

Package facts

LicenseBSD-3-Clause permissive
Python supportSupports the current Python release >=3.10
Install frictionLow. Pure-Python wheel
Runtime dependencies
1 package
respx
MaintenanceActively maintained 86 days since the last release
Last repo commit
First released
Downloads140,866 / month, #11,261 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Operating System :: OS IndependentProgramming Language :: Python :: 3

Evidence: pytest_httpx2-1.0.0-py3-none-any.whl

Tags

Capabilities
pytest httpx2 mockingmock http requests in testsrespx pytest pluginhttpx2 test fixturesfake http responses pytest
Topics
http-mockingtest-fixtures

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “pytest httpx2 mocking”

  • pytest-httpx2A pytest plugin that mocks httpx2 HTTP requests using respx, letting…
  • pytest-responsesAutomatically mocks HTTP requests across your pytest test suite using…
  • pytest-mockProvides a pytest fixture that wraps the mock library's patching API,…

Give your agent the search over MCP, or paste the wish link into any chat.

More Testing packages

pluggy Worth it
PyPI · Libraries · released May 2025

Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.

Install it if you're building an extensible application or framework.

MITpure Python · 3.9+aging
1.3Bdownloads / mo
pytest Worth it
PyPI · Libraries · released Jun 2026

pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.

MITpure Python · 3.10+
1.1Bdownloads / mo
virtualenv Worth it
PyPI · Libraries · released Aug 2026

virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.

MITpure Python · 3.9+
532.9Mdownloads / mo
coverage Worth it
PyPI · Testing · released Aug 2026

Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.

Install it if you want to measure test completeness or enforce coverage thresholds in your project.

permissive licensepure Python · 3.10+
335.8Mdownloads / mo
pytest-asyncio Worth it
PyPI · Testing · released May 2026

pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.

Install it if you write tests for any asyncio-based code.

Apache-2.0pure Python · 3.10+
275.9Mdownloads / mo
pytest-json-ctrf Worth it
PyPI · Testing · released Jul 2026

A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.

Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.

MITpure Python · 3.8+
273.0Mdownloads / mo

See also pytest_httpserver · respx · pytest-responses · urllib3-mock · httpx2 · aioresponses · pytest-mock · aresponses · pytest-localserver · pytest-console-scripts