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

chore: allow urllib3>=1.25.10 #659

Merged
merged 1 commit into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
requests-version: ['"requests>=2.0,<3.0"']
urllib3-version: ['"urllib3<2"', '"urllib3>=2,<3.0"']


steps:
- uses: actions/checkout@v3
Expand All @@ -46,7 +48,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ${{ matrix.requests-version }}
pip install ${{ matrix.requests-version }} ${{ matrix.urllib3-version }}
make install-deps

- name: Run Pytest
Expand Down
6 changes: 6 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
0.23.3
------

* Allow urllib3>=1.25.10


0.23.2
------

Expand Down
14 changes: 11 additions & 3 deletions responses/tests/test_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import pytest
import requests
import urllib3
from requests.exceptions import ChunkedEncodingError
from requests.exceptions import ConnectionError
from requests.exceptions import HTTPError
Expand Down Expand Up @@ -1534,10 +1535,17 @@ def run():
headers={"Content-Length": "2"},
auto_calculate_content_length=True,
)
with pytest.raises(ChunkedEncodingError) as excinfo:
requests.get(url)

assert "IncompleteRead(4 bytes read, -2 more expected)" in str(excinfo.value)
if urllib3.__version__ < "2":
resp = requests.get(url)
assert_response(resp, "test")
assert resp.headers["Content-Length"] == "2"
else:
with pytest.raises(ChunkedEncodingError) as excinfo:
requests.get(url)
assert "IncompleteRead(4 bytes read, -2 more expected)" in str(
excinfo.value
)

run()
assert_reset()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

install_requires = [
"requests>=2.30.0,<3.0",
"urllib3>=2.0.0,<3.0",
"urllib3>=1.25.10,<3.0",
"pyyaml",
"types-PyYAML",
"typing_extensions; python_version < '3.8'",
Expand Down