Skip to main content

py.test integration for responses

Project description

https://img.shields.io/pypi/v/pytest-responses.svg https://github.com/getsentry/pytest-responses/workflows/Test/badge.svg

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

If you're not sure about the file name format, learn more about wheel file names.

pytest_responses-0.6.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file pytest_responses-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_responses-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e94717b5235a2e1f66b27bcfc895dfa6705e79678e5c05eae9bb06fcf95a0182
MD5 4ef3447a73b9c71fd0164e6b423658d6
BLAKE2b-256 bae7b4712a52ac5a4a87186a57bc974b3eadd5b7253a413edd41ff3f966dc2ce

See more details on using hashes here.

Supported by

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