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

pytest_responses-0.5.1-py2.py3-none-any.whl (6.7 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: pytest_responses-0.5.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

File hashes

Hashes for pytest_responses-0.5.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4172e565b94ac1ea3b10aba6e40855ad60cd7f141476b2d8a47e4b5f250be734
MD5 ab189988bba0ed270930b95330a49d3d
BLAKE2b-256 c40a81b8cc3cf4b6605d97ed37217af9e2f82c97ebe130f60cf85fe82edfe0e1

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