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

Fix urllib3 mocking to conform to current API #602

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

Conversation

Perfect5th
Copy link

@Perfect5th Perfect5th commented Jul 1, 2023

The expected responses from requests requests are now instances of urllib3.response.HTTPResponse, not http.client.HTTPResponse. This change both fixes that, and ensures the response can be read by fixing the incorrect HTTP message (it was missing a CRLF). I also added a Content-Type header because sometimes the request body does not get read if this header is absent.

tox should pass for py38 and py310. I didn't test py35 and py36 as both are now EOL.

fixes #601

@Perfect5th
Copy link
Author

New rev with fixes for 3.5 and 3.6 - turns out the old behaviour of the mock was what they wanted. Proof tox is passing for these versions: https://github.com/Perfect5th/talisker/actions/runs/5438859830/jobs/9890351211

Will work on other failing CI bits soon (docs, etc)

@Perfect5th
Copy link
Author

Bumping the Sphinx version gets the docs building again (see https://github.com/Perfect5th/talisker/actions/runs/5439103405), so this now also closes #599 and therefore closes #600

tests/test_requests.py Outdated Show resolved Hide resolved
tests/test_requests.py Outdated Show resolved Hide resolved
Copy link

@wgrant wgrant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM now.

@verterok
Copy link
Contributor

verterok commented May 7, 2024

Looks like this was left behind, sorry for missing it.
I just tried to run the CI jobs and looks like one dependency needs to be updated:

diff --git a/requirements.tests.txt b/requirements.tests.txt
index d36d68c..2765aa8 100644
--- a/requirements.tests.txt
+++ b/requirements.tests.txt
@@ -16,7 +16,7 @@ setuptools==44.0.0;python_version<"3.10"
 setuptools>64;python_version>="3.10"
 coverage==5.0.3;python_version<"3.10"
 coverage>=6;python_version>="3.10"
-flaky==3.6.1
+flaky==3.8.1

 # for integration tests
 # eventlet is pinned until https://github.com/benoitc/gunicorn/pull/2581

If you want to include the change in your PR, it should land (tested locally)

@Perfect5th
Copy link
Author

Perfect5th commented May 10, 2024

I've added the suggested flaky dependency version change to the PR, thanks @verterok !

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.

tests broken
3 participants