Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export names matchers and Response from RequestsMock instances #739

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

filbranden
Copy link

This makes it possible to import or access only RequestsMock (possibly via a pytest fixture) and still be able to easily access the matchers or assemble a Response object.

It also makes it easier to adopt pytest-responses which uses responses as the fixture variable which would conflict with an import of this module.

Add test cases that mask the existing imports and still access matchers or assemble a Response object via the RequestsMock instance.

Also recommend using pytest-responses for a pytest fixture. Rather than explaining how to roll your own in a Markdown snippet, recommend using the companion package to get a standard responses pytest fixture easily usable in test cases.

This makes it possible to import or access only RequestsMock (possibly via a pytest fixture) and still be able to easily access the matchers or assemble a Response object.

It also makes it easier to adopt pytest-responses which uses `responses` as the fixture variable which would conflict with an import of this module.

Add test cases that mask the existing imports and still access matchers or assemble a Response object via the RequestsMock instance.
Rather than explaining how to roll your own in Markdown, recommend using the companion package to get a standard `responses` pytest fixture easily usable in test cases
@filbranden
Copy link
Author

See somewhat related getsentry/pytest-responses#30 proposing some usability improvements in pytest-responses as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant