tests: replace `httpretty` with `responses` (#10620)
Notable changes: - When registering a regex for a URL, you have to consider credentials. (See change in `test_authenticator.py`) - The regex for urls not ending with "/json" in `pypi_repository` in `pypi.py` did match urls ending with "/json". This was probably not an issue with `httpretty` because patterns were evaluated in a specific order. - In `with_disallowed_pypi_search_html` in `pypi.py`, we just added another callback for a URL. With `responses`, we have to remove the existing one before adding a new one, otherwise the existing one may get used. - In `responses` requests, your cannot just access any header and get `None` if it does not exist. You have to check for existence. - It seems like `responses` does not automatically add a `Content-Length` header to responses so that we have to do that manually if it is required by the tested code. - In an uploader test, we generated a 304 response with a body (which is invalid). With `httpretty` the test passed anyway, with `responses` we get a chunked encoding error.
Loading
Please register or sign in to comment