Skip to content
Unverified Commit 4e181a1a authored by Randy Döring's avatar Randy Döring Committed by GitHub
Browse files

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.
parent 7c4e9e31
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment