Migration Guide#
If you’re reading this, you’re probably interested in Niquests. We’re thrilled to have you onboard.
This section will cover two use cases:
I am a developer that regularly drive Requests
I am a library maintainer that depend on Requests
Developer migration#
Niquests aims to be as compatible as possible with Requests, and that is with confidence that you can migrate to Niquests without breaking changes.
Would turn into either
Or simply
Maintainer migration#
In order to migrate your library with confidence, you’ll have to also adjust your tests. The library itself (sources) should be really easy to migrate (cf. developer migration) but the tests may be harder to adapt.
The main reason behind this difficulty is often related to a strong tie with third-party
mocking library such as response
.
To overcome this, we will introduce you to a clever bypass. If you are using pytest, do the
following in your conftest.py
, see https://docs.pytest.org/en/6.2.x/fixture.html#conftest-py-sharing-fixtures-across-multiple-files
for more information. (The goal would simply to execute the following piece of code before the tests)
Warning
This code sample is only to be executed in a development environment, it permit to fool the third-party dependencies that have a strong tie on Requests.