Skip to content

Commit

Permalink
fix test compatibility with urllib3 (#636)
Browse files Browse the repository at this point in the history
- Upgrade urllib3 and requests
  • Loading branch information
beliaev-maksim authored May 9, 2023
1 parent 9428c2f commit 0713065
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
0.23.2
------

* Updated dependency to urllib3>=2 and requests>=2.30.0. See #635


0.23.1
------

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ A utility library for mocking out the ``requests`` Python library.

.. note::

Responses requires Python 3.7 or newer, and requests >= 2.22.0
Responses requires Python 3.7 or newer, and requests >= 2.30.0


Table of Contents
Expand Down
9 changes: 5 additions & 4 deletions responses/tests/test_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1498,9 +1498,10 @@ def run():
headers={"Content-Length": "2"},
auto_calculate_content_length=True,
)
resp = requests.get(url)
assert_response(resp, "test")
assert resp.headers["Content-Length"] == "2"
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 Expand Up @@ -2416,7 +2417,7 @@ def set_session(self, total=4, raise_on_status=True):
total=total,
backoff_factor=0.1,
status_forcelist=[500],
method_whitelist=["GET", "POST", "PATCH"],
allowed_methods=["GET", "POST", "PATCH"],
raise_on_status=raise_on_status,
)
)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
setup_requires = []

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

0 comments on commit 0713065

Please sign in to comment.