skip to navigation
skip to content

pytest-responses 0.2.0

py.test integration for responses

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
 
File Type Py Version Uploaded on Size
pytest-responses-0.2.0.tar.gz (md5) Source 2017-07-25 5KB
pytest_responses-0.2.0-py2.py3-none-any.whl (md5) Python Wheel 2.7 2017-07-25 3KB