From 071306524af1b4ee1797c45a46525274d271a9b6 Mon Sep 17 00:00:00 2001 From: Maksim Beliaev Date: Tue, 9 May 2023 21:14:27 +0200 Subject: [PATCH] fix test compatibility with urllib3 (#636) - Upgrade urllib3 and requests --- CHANGES | 6 ++++++ README.rst | 2 +- responses/tests/test_responses.py | 9 +++++---- setup.py | 4 ++-- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index f3a0080c..f6a8d12f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ +0.23.2 +------ + +* Updated dependency to urllib3>=2 and requests>=2.30.0. See #635 + + 0.23.1 ------ diff --git a/README.rst b/README.rst index cfdf0b20..7d790eb0 100644 --- a/README.rst +++ b/README.rst @@ -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 diff --git a/responses/tests/test_responses.py b/responses/tests/test_responses.py index 90c1d657..c264e4e9 100644 --- a/responses/tests/test_responses.py +++ b/responses/tests/test_responses.py @@ -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() @@ -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, ) ) diff --git a/setup.py b/setup.py index 6d01ad20..f61b30ad 100644 --- a/setup.py +++ b/setup.py @@ -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'",