Skip to main content

py.test integration for responses

Project description

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

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pytest_responses-0.3.0-py2.py3-none-any.whl (3.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pytest_responses-0.3.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_responses-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4556395e4d1d69620027e618c302f0dbe16eef05b1037dc5955c921b6d3bc0ee
MD5 755a87ccb30c10192ca307317fabcc0c
BLAKE2b-256 3bd6eb60f9f07610bef3a49637a7d77f0dca78a964d48613b7d3d3c33bf94489

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page