Skip to main content

pytest-httpx2

A pytest plugin for mocking out httpx2 using respx.

import httpx2

def test_foobar(httpx2_mock: respx.Router) -> None:
    httpx2_mock.post("https://example.com/foobar").respond(201)
    response = httpx2.post("https://example.com/foobar")
    assert response.status_code == 201

Configure using marker

import pytest
import httpx2

@pytest.mark.httpx2(base_url="https://example.com")
def test_hamspam(httpx2_mock: respx.Router) -> None:
    httpx2_mock.get("/hamspam").respond(json={"id": 1337})
    response = httpx2.get("https://example.com/hamspam")
    assert response.status_code == 200
    assert response.json() == {"id": 1337}

See respx documentation for more configuration options and api.

Metadata

Release files for pytest-httpx2 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-httpx2 1.0.0
File Size Uploaded
pytest_httpx2-1.0.0.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-httpx2 1.0.0
File Interpreter ABI Platform
pytest_httpx2-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.4 kB

Release files / pytest_httpx2-1.0.0.tar.gz

Download URL pytest_httpx2-1.0.0.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d897a14c1341d3f3014e9432c16fed366598aba06a2ba9c08460a51799cb7128
BLAKE2b-256 checksum
How to use checksums
43d170e7edb50679ddd34ba5e13ac1d6e1223bc4e24d0a5fc30587f8fbe884c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / pytest_httpx2-1.0.0-py3-none-any.whl

Download URL pytest_httpx2-1.0.0-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
467dc7f6946854ffc20e1678703266b093037d8f3fb9f1fb523a2c432c64cff0
BLAKE2b-256 checksum
How to use checksums
54e15e38e8de42fba9667846a43113469c7481d01db4b6511e42645385bace8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page