pytest fixture for HTTPX
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)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest_httpx-0.0.1.tar.gz | 3.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|