https://github.com/getsentry/pytest-responses
py.test integration for responses
https://github.com/getsentry/pytest-responses
tag-non-production
Last synced: about 2 months ago
JSON representation
py.test integration for responses
- Host: GitHub
- URL: https://github.com/getsentry/pytest-responses
- Owner: getsentry
- License: apache-2.0
- Created: 2016-12-12T20:40:28.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2024-12-17T21:00:19.000Z (6 months ago)
- Last Synced: 2025-04-06T05:14:57.110Z (2 months ago)
- Topics: tag-non-production
- Language: Python
- Homepage:
- Size: 36.1 KB
- Stars: 90
- Watchers: 43
- Forks: 16
- Open Issues: 5
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGES
- License: LICENSE
Awesome Lists containing this project
README
pytest-responses
================.. image:: https://img.shields.io/pypi/v/pytest-responses.svg
:target: https://pypi.python.org/pypi/pytest-responses/
.. image:: https://github.com/getsentry/pytest-responses/workflows/Test/badge.svg
:target: https://github.com/getsentry/pytest-responses/actions/workflows/test.ymlAutomatically activate responses across your py.test-powered test suite (thus preventing HTTP requests).
.. sourcecode:: shell
$ pip install pytest-responses
If particular tests need access to external domains, you can use the ``withoutresponses`` marker:
.. sourcecode:: python
@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:
.. sourcecode:: python
def test_enabled(responses):
with pytest.raises(ConnectionError):
requests.get('http://responses.invalid')assert len(responses.calls) == 1