Skip to content

Repository files navigation

pytest-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.withoutresponsesdeftest_disabled():
withpytest.raises(ConnectionError):
requests.get('http://responses.invalid')
assertlen(responses.calls) ==0

Additionally, you can use the responses fixture:

deftest_enabled(responses):
withpytest.raises(ConnectionError):
requests.get('http://responses.invalid')
assertlen(responses.calls) ==1

About

py.test integration for responses

Topics

Resources

Code of conduct

Security policy

Stars

95 stars

Watchers

37 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages