responses
pytest-recording
Our great sponsors
responses | pytest-recording | |
---|---|---|
12 | 1 | |
4,030 | 374 | |
0.6% | 4.8% | |
8.0 | 7.0 | |
about 1 month ago | 3 days ago | |
Python | Python | |
Apache License 2.0 | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
responses
- Please recommend a good API Mocking tool
-
How I start every new Python backend API project
responses
- We Just Gave $260,028 to Open Source Maintainers
-
Two Methods for Testing HTTPS API Calls with Python and pytest and also Communicating with the In-laws
HTTP client library flexibility. Yes, requests pairs well with responses or requests-mock, and HTTPX has RESPX or pytest_httpx. Those testing helpers are an excellent match for the corresponding library, and should certainly be recommended. However, I don't always want to face the risk of rewriting all my tests if I replace the client library some day. And sometimes I am using an altogether different tool (even though both requests and HTTPX are quite awesome) such as urlopen, urllib3, httplib2, tornado, or aiohttp.
-
A few tools for using HTTPS in tests
I also know there is vcr, and requests pairs well with responses or requests-mock, and HTTPX has RESPX or pytest_httpx.
pytest-recording
-
Two Methods for Testing HTTPS API Calls with Python and pytest and also Communicating with the In-laws
An alternate approach involves using VCR.py, a tool that records HTTP interactions in YAML files, then intercepts future HTTP requests and plays back the recorded responses. In this tutorial, we will use pytest-vcr to interface with VCR.py, although pytest-recording is another good option for doing the same.
What are some alternatives?
httpretty - Intercept HTTP requests at the Python socket level. Fakes the whole socket module
VCR.py - Automatically mock your HTTP interactions to simplify and speed up testing
httmock - A mocking library for requests
Selenium Wire - Extends Selenium's Python bindings to give you the ability to inspect requests made by the browser.
Moto - A library that allows you to easily mock out tests based on AWS infrastructure.
mock - The Python mock library
betamax - A VCR imitation designed only for python-requests.
Mocket - a socket mock framework - for all kinds of socket animals, web-clients included
freezegun - Let your Python tests travel through time
PyRestTest - Python Rest Testing
Schemathesis - Automate your API Testing: catch crashes, validate specs, and save time
python-libfaketime - A fast time mocking alternative to freezegun that wraps libfaketime.