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.
Release files for pytest-pypi 0.1.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-pypi-0.1.1.tar.gz | 9.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_pypi-0.1.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 16.7 kB
Release files / pytest-pypi-0.1.1.tar.gz
| Download URL | pytest-pypi-0.1.1.tar.gz |
|---|---|
| Size | 9.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4da2f2e88777b53b2f3e7aff66065886f90e23b55f345b15ccf404afb7e8883e
|
|
BLAKE2b-256 checksum How to use checksums |
c9ee856f0ee91f9005e88be05c74888a43116a4fc7aae13ec0d099f0367c7b3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pytest_pypi-0.1.1-py2.py3-none-any.whl
| Download URL | pytest_pypi-0.1.1-py2.py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
a304d3fef4549c929cf77bc9edc478bba806696d16c6a18a9cb023cb45bc8d08
|
|
BLAKE2b-256 checksum How to use checksums |
6ac08115bd72e3585dcbba1c0842ccb7e526eb3f5084903e9bfffcf0c1e12a92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |