Skip to main content

pytest fixture for HTTPX

pypi version Build status Coverage Code style: black Number of tests Number of downloads

This module is still under development and cannot be considered stable.

Use pytest_httpx.httpx_mock pytest fixture to mock httpx requests.

Add responses

import httpx
from pytest_httpx import httpx_mock, HTTPXMock


def test_something(httpx_mock: HTTPXMock):
    httpx_mock.add_response("http://test_url")

    response = httpx.get("http://test_url")

If all responses are not sent back during test execution, the test case will fail.

Check sent requests

import httpx
from pytest_httpx import httpx_mock, HTTPXMock


def test_something(httpx_mock: HTTPXMock):
    httpx_mock.add_response("http://test_url")

    response = httpx.get("http://test_url")

    # requests are in httpx_mock.requests

Release files for pytest-httpx 0.0.1

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-httpx 0.0.1
File Size Uploaded
pytest_httpx-0.0.1.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-httpx 0.0.1
File Interpreter ABI Platform
pytest_httpx-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.2 kB

Release files / pytest_httpx-0.0.1.tar.gz

Download URL pytest_httpx-0.0.1.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d7431dc30637a00f1f0afa95713ca73a022b7f53ac6f8a00b5679baaf6a0a6cd
BLAKE2b-256 checksum
How to use checksums
9e563771603c1636b38e89be8d26cd12dc032b0db7f9487ee87e38293292f2fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.7

Release files / pytest_httpx-0.0.1-py3-none-any.whl

Download URL pytest_httpx-0.0.1-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af6c32a86017eb4b701cc6f5cd8dc843336e479a9164059a6dfbf9536e7427f7
BLAKE2b-256 checksum
How to use checksums
0e8e00159fef20086d3f0b1b78f2a42bed03d4e8b2b84b04a4d0a15f48fdcf1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.7

Release history Release notifications | RSS feed

0.35.0

2 release files

0.34.0

2 release files

0.33.0

2 release files

0.32.0

2 release files

0.31.2

2 release files

0.31.1

2 release files

0.31.0

2 release files

0.30.0

2 release files

0.29.0

2 release files

0.28.0

2 release files

0.27.0

2 release files

0.26.0

2 release files

0.25.0

2 release files

0.22.0

2 release files

0.21.3

2 release files

0.21.1

2 release files

0.21.0

2 release files

0.19.0

2 release files

0.18.0

2 release files

0.17.3

2 release files

0.17.2

2 release files

0.17.1

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.14.0

2 release files

0.13.0

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.10.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

This release

0.0.1 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