diff --git a/636-urllib3-2-compat.patch b/636-urllib3-2-compat.patch new file mode 100644 index 0000000..e5728ae --- /dev/null +++ b/636-urllib3-2-compat.patch @@ -0,0 +1,68 @@ +--- + CHANGES | 6 ++++++ + README.rst | 2 +- + responses/tests/test_responses.py | 9 +++++---- + setup.py | 4 ++-- + 4 files changed, 14 insertions(+), 7 deletions(-) + +--- 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 + ------ + +--- a/README.rst ++++ b/README.rst +@@ -17,7 +17,7 @@ A utility library for mocking out the `` + + .. 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 +--- a/responses/tests/test_responses.py ++++ b/responses/tests/test_responses.py +@@ -1498,9 +1498,10 @@ def test_auto_calculate_content_length_d + 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 @@ class TestMaxRetry: + 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, + ) + ) +--- a/setup.py ++++ b/setup.py +@@ -17,8 +17,8 @@ from setuptools.command.test import test + setup_requires = [] + + install_requires = [ +- "requests>=2.22.0,<3.0", +- "urllib3>=1.25.10", ++ "requests>=2.23.0,<3.0", ++ "urllib3>=2.0.0,<3.0", + "pyyaml", + "typing_extensions; python_version < '3.8'", + ] diff --git a/compat-urllib3-2.patch b/compat-urllib3-2.patch deleted file mode 100644 index f9dbc69..0000000 --- a/compat-urllib3-2.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- - responses/tests/test_responses.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/responses/tests/test_responses.py -+++ b/responses/tests/test_responses.py -@@ -2417,7 +2417,7 @@ class TestMaxRetry: - 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/python-responses.spec b/python-responses.spec index 9c86cd3..8a68251 100644 --- a/python-responses.spec +++ b/python-responses.spec @@ -25,10 +25,12 @@ License: Apache-2.0 Group: Development/Languages/Python URL: https://github.com/getsentry/responses Source: https://files.pythonhosted.org/packages/source/r/responses/responses-%{version}.tar.gz +# PATCH-FIX-UPSTREAM 636-urllib3-2-compat.patch gh#getsentry/responses!636 mcepl@suse.com +# Make the package compatible with urllib3 >= 2.0 +Patch0: 636-urllib3-2-compat.patch # PATCH-FIX-UPSTREAM unbundle-urllib3.patch gh#getsentry/responses#635, mcepl@suse.com # Don't use urllib3 bundled in requests. -Patch0: unbundle-urllib3.patch -Patch1: compat-urllib3-2.patch +Patch1: unbundle-urllib3.patch BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module wheel} @@ -47,9 +49,6 @@ BuildRequires: %{python_module urllib3 >= 2} Requires: python-PyYAML Requires: python-urllib3 >= 2 Requires: (python-requests >= 2.22.0 with python-requests < 3) -%if %{python_version_nodots} < 38 -Requires: python-typing_extensions -%endif BuildArch: noarch %python_subpackages @@ -59,8 +58,8 @@ Check https://github.com/getsentry/responses for more information about the library. %prep -%setup -q -n responses-%{version} -%autopatch -p1 +%autosetup -p1 -n responses-%{version} + # Remove typing stub requirements sed -i /types-/d setup.py diff --git a/unbundle-urllib3.patch b/unbundle-urllib3.patch index 724a7b3..8f9d838 100644 --- a/unbundle-urllib3.patch +++ b/unbundle-urllib3.patch @@ -2,8 +2,7 @@ responses/__init__.py | 8 ++++---- responses/matchers.py | 2 +- responses/tests/test_responses.py | 5 +++-- - setup.py | 2 +- - 4 files changed, 9 insertions(+), 8 deletions(-) + 3 files changed, 8 insertions(+), 7 deletions(-) --- a/responses/__init__.py +++ b/responses/__init__.py @@ -74,14 +73,3 @@ ) run() ---- a/setup.py -+++ b/setup.py -@@ -18,7 +18,7 @@ setup_requires = [] - - install_requires = [ - "requests>=2.22.0,<3.0", -- "urllib3>=1.25.10", -+ "urllib3>=2.0.0", - "pyyaml", - "types-PyYAML", - "typing_extensions; python_version < '3.8'",