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.4.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

pytest_responses-0.4.0-py2.py3-none-any.whl (6.6 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: pytest-responses-0.4.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for pytest-responses-0.4.0.tar.gz
Algorithm Hash digest
SHA256 cef8c360273842700733c7849b75219f425edc3f8e22704114778bde3e08e3f7
MD5 650abb383f960a20ae2eef22d968563f
BLAKE2b-256 ffa601c17ba4083e61f770bed4d339fe98a26a74778c9788361cc7572fcb43e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytest_responses-0.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1943af2548687c2e1153722f1b2f4a7152d65006ac85508fec8132d3fd5d0c0d
MD5 ab4b30436bfb1df07b5b258860021d13
BLAKE2b-256 f236b3ff5c6408f0290e33960e2630e63dc3eb89faf16e1d80c3af51b82df41f

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