A pytest plugin for mocking out httpx2 using respx.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytest_httpx2-1.0.0.tar.gz
(2.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest_httpx2-1.0.0.tar.gz.
File metadata
- Download URL: pytest_httpx2-1.0.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d897a14c1341d3f3014e9432c16fed366598aba06a2ba9c08460a51799cb7128
|
|
| MD5 |
166a258bca57276e8ce2118f2edebf70
|
|
| BLAKE2b-256 |
43d170e7edb50679ddd34ba5e13ac1d6e1223bc4e24d0a5fc30587f8fbe884c4
|
File details
Details for the file pytest_httpx2-1.0.0-py3-none-any.whl.
File metadata
- Download URL: pytest_httpx2-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
467dc7f6946854ffc20e1678703266b093037d8f3fb9f1fb523a2c432c64cff0
|
|
| MD5 |
64d6144906bcd7e0445bfc12e76f656d
|
|
| BLAKE2b-256 |
54e15e38e8de42fba9667846a43113469c7481d01db4b6511e42645385bace8f
|