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 Distribution

pytest-responses-0.2.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

pytest_responses-0.2.0-py2.py3-none-any.whl (3.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pytest-responses-0.2.0.tar.gz.

File metadata

File hashes

Hashes for pytest-responses-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8b5ad307e3b570a14a3f9325c8de52cd4d4620ffab338f48f1d338ab39ada235
MD5 f4a945f40b4db35c1dc63702176b9e0f
BLAKE2b-256 beabda1074d0b779b1d4a7b2393493e694f8b93b2dfd16b0e43f202ebdbdc16d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytest_responses-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 13a342c11cbb4c11231403019cb1033a5e9f7917db5408f59c92806dc064e5eb
MD5 02deb9d2e7f4584c7bb1cc5edd1ca76f
BLAKE2b-256 088681b4d11c9ed633d7aa5e98682a9ad65fbe37768a87da1a11c0f2c4f24846

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