Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Easily test your HTTP library against a local copy of pypi

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pytest-pypi, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size pytest_pypi-0.1.1-py2.py3-none-any.whl (7.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size pytest-pypi-0.1.1.tar.gz (9.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page