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 test compatibility with urllib3 #636

Merged
merged 1 commit into from
May 9, 2023

Conversation

beliaev-maksim
Copy link
Collaborator

closes #635
I thought more about the issue #635. Actually, we are back compatible.

urllib3 now enforces content length validation. Our lib proposes auto calculation of content length. However, if the user wants to provide a header and the header does not match actual content length, then user gets an error.
Which is expected from the new urllib3

@codecov
Copy link

codecov bot commented May 9, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (9428c2f) 100.00% compared to head (1eb0962) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #636   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines         2858      2858           
=========================================
  Hits          2858      2858           
Impacted Files Coverage Δ
responses/tests/test_responses.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@markstory markstory merged commit 0713065 into getsentry:master May 9, 2023
@beliaev-maksim beliaev-maksim deleted the mbeliaev/urllib branch May 10, 2023 08:12
phanak-sap added a commit to phanak-sap/python-pyodata that referenced this pull request May 15, 2023
The entire logic of the test was based on scenario that server returns response of HTTP 204 No Content (which ends with HTTP Header) with some content in HTTP Body, which is breaking the HTTP protocol logic itself.

The Responses package generated such weird simulated response, but now, with being compatible with urllib3 2.x, breaking changes were introduced within this transitive dependency.

On the requests side, the bump to same urllib3 2.x means test failures with
requests.exceptions.ChunkedEncodingError: ('Connection broken: IncompleteRead(10 bytes read, -10 more expected)', IncompleteRead(10 bytes read, -10 more expected))

More info:

getsentry/responses#636
https://urllib3.readthedocs.io/en/latest/v2-migration-guide.html

RFC 2616  - HTTP 1.1 - 10.2.5 - 204 No Content
https://datatracker.ietf.org/doc/html/rfc2616#section-10.2.5
phanak-sap added a commit to phanak-sap/python-pyodata that referenced this pull request May 15, 2023
- remove remove test_function_import_without_return_type_wrong_code

The entire logic of the test was based on scenario that server returns response of HTTP 204 No Content (which ends with HTTP Header) with some content in HTTP Body, which is breaking the HTTP protocol logic itself.

The Responses package generated such weird simulated response and was parsed with urllib 1.X in previous versions of Requests, but now, with being compatible with urllib3 2.x, breaking changes were introduced within this transitive dependency.

On the requests side, the bump to same urllib3 2.x means test failures with error:

requests.exceptions.ChunkedEncodingError: ('Connection broken: IncompleteRead(10 bytes read, -10 more expected)', IncompleteRead(10 bytes read, -10 more expected))

- test_update_entity

Same rationale, removed invalid body for expected HTTP 204 simulated response

Additional info:

getsentry/responses#636
https://urllib3.readthedocs.io/en/latest/v2-migration-guide.html

RFC 2616  - HTTP 1.1 - 10.2.5 - 204 No Content
https://datatracker.ietf.org/doc/html/rfc2616#section-10.2.5
phanak-sap added a commit to phanak-sap/python-pyodata that referenced this pull request May 15, 2023
- remove remove test_function_import_without_return_type_wrong_code

The entire logic of the test was based on scenario that server returns response of HTTP 204 No Content (which ends with HTTP Header) with some content in HTTP Body, which is breaking the HTTP protocol logic itself.

The Responses package generated such weird simulated response and was parsed with urllib 1.X in previous versions of Requests, but now, with being compatible with urllib3 2.x, breaking changes were introduced within this transitive dependency.

On the requests side, the bump to same urllib3 2.x means test failures with error:

requests.exceptions.ChunkedEncodingError: ('Connection broken: IncompleteRead(10 bytes read, -10 more expected)', IncompleteRead(10 bytes read, -10 more expected))

- test_update_entity

Same rationale, removed invalid body for expected HTTP 204 simulated response

Additional info:

getsentry/responses#636
https://urllib3.readthedocs.io/en/latest/v2-migration-guide.html

RFC 2616  - HTTP 1.1 - 10.2.5 - 204 No Content
https://datatracker.ietf.org/doc/html/rfc2616#section-10.2.5
filak-sap pushed a commit to SAP/python-pyodata that referenced this pull request May 17, 2023
- remove remove test_function_import_without_return_type_wrong_code

The entire logic of the test was based on scenario that server returns response of HTTP 204 No Content (which ends with HTTP Header) with some content in HTTP Body, which is breaking the HTTP protocol logic itself.

The Responses package generated such weird simulated response and was parsed with urllib 1.X in previous versions of Requests, but now, with being compatible with urllib3 2.x, breaking changes were introduced within this transitive dependency.

On the requests side, the bump to same urllib3 2.x means test failures with error:

requests.exceptions.ChunkedEncodingError: ('Connection broken: IncompleteRead(10 bytes read, -10 more expected)', IncompleteRead(10 bytes read, -10 more expected))

- test_update_entity

Same rationale, removed invalid body for expected HTTP 204 simulated response

Additional info:

getsentry/responses#636
https://urllib3.readthedocs.io/en/latest/v2-migration-guide.html

RFC 2616  - HTTP 1.1 - 10.2.5 - 204 No Content
https://datatracker.ietf.org/doc/html/rfc2616#section-10.2.5
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.

test_auto_calculate_content_length_doesnt_override_existing_value fails
2 participants