Skip to main content

httpbin is an amazing web service for testing HTTP libraries. It has several great endpoints that can test pretty much everything you need in a HTTP library. The only problem is: maybe you don’t want to wait for your tests to travel across the Internet and back to make assertions against a remote web service.

Enter pytest-httpbin. Pytest-httpbin creates a pytest “fixture” that is dependency-injected into your tests. It automatically starts up a HTTP server in a separate thread running httpbin and provides your test with the URL in the fixture. Check out this example:

def test_that_my_library_works_kinda_ok(httpbin):
    assert requests.get(httpbin.url + '/get/').status_code == 200

This replaces a test that might have looked like this before:

def test_that_my_library_works_kinda_ok():
    assert requests.get('http://httpbin.org/get').status_code == 200

pytest-httpbin also supports https and includes its own CA cert you can use. Check out the full documentation on the github page.

Metadata

Release files for pytest-httpbin 2.1.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-httpbin 2.1.0
File Size Uploaded
pytest_httpbin-2.1.0.tar.gz 13.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-httpbin 2.1.0
File Interpreter ABI Platform
pytest_httpbin-2.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.0 kB

Release files / pytest_httpbin-2.1.0.tar.gz

Download URL pytest_httpbin-2.1.0.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d40579838443228327f9fe4f08d9338bee8885c29fe933e5f2d58c20a26c33c6
BLAKE2b-256 checksum
How to use checksums
438323b510bb5f20b1982f010dbf82d17e21f701470033e2f4d952ce6cf7a1c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.6

Release files / pytest_httpbin-2.1.0-py3-none-any.whl

Download URL pytest_httpbin-2.1.0-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b3bf7346cc2ad231447189cd85b458e341056684a7a69d69533dd29692209cdd
BLAKE2b-256 checksum
How to use checksums
0d97149289c7123f75e98edc94872545c2f597f349ee037b1e0a47aef0362fd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.6
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