Automatically activate responses across your py.test-powered test suite (thus preventing HTTP requests).
$ pip install pytest-responses
If particular tests need access to external domains, you can use the withoutresponses marker:
@pytest.mark.withoutresponses
def test_disabled():
with pytest.raises(ConnectionError):
requests.get('http://responses.invalid')
assert len(responses.calls) == 0
Additionally, you can use the responses fixture:
def test_enabled(responses):
with pytest.raises(ConnectionError):
requests.get('http://responses.invalid')
assert len(responses.calls) == 1
Release files for pytest-responses 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_responses-0.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / pytest_responses-0.6.0-py3-none-any.whl
| Download URL | pytest_responses-0.6.0-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e94717b5235a2e1f66b27bcfc895dfa6705e79678e5c05eae9bb06fcf95a0182
|
|
BLAKE2b-256 checksum How to use checksums |
bae7b4712a52ac5a4a87186a57bc974b3eadd5b7253a413edd41ff3f966dc2ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.2
|