Accepting request 744659 from devel:languages:python
OBS-URL: https://build.opensuse.org/request/show/744659 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-requests?expand=0&rev=61
This commit is contained in:
commit
1a3dbe6bb6
27
merged_pr_5049.patch
Normal file
27
merged_pr_5049.patch
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
From dc75b3ca0b4c95648eb07b92cb414394d99c13a0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
|
||||||
|
Date: Mon, 8 Apr 2019 18:04:22 +0200
|
||||||
|
Subject: [PATCH] Support pytest 4
|
||||||
|
|
||||||
|
Fixes https://github.com/kennethreitz/requests/issues/5048
|
||||||
|
|
||||||
|
See https://docs.pytest.org/en/latest/deprecations.html#marks-in-pytest-mark-parametrize
|
||||||
|
---
|
||||||
|
setup.py | 2 +-
|
||||||
|
tests/test_utils.py | 3 ++-
|
||||||
|
2 files changed, 3 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tests/test_utils.py b/tests/test_utils.py
|
||||||
|
index 59b0b0efa..62c51494d 100644
|
||||||
|
--- a/tests/test_utils.py
|
||||||
|
+++ b/tests/test_utils.py
|
||||||
|
@@ -33,7 +33,8 @@ class TestSuperLen:
|
||||||
|
'stream, value', (
|
||||||
|
(StringIO.StringIO, 'Test'),
|
||||||
|
(BytesIO, b'Test'),
|
||||||
|
- pytest.mark.skipif('cStringIO is None')((cStringIO, 'Test')),
|
||||||
|
+ pytest.param(cStringIO, 'Test',
|
||||||
|
+ marks=pytest.mark.skipif('cStringIO is None')),
|
||||||
|
))
|
||||||
|
def test_io_streams(self, stream, value):
|
||||||
|
"""Ensures that we properly deal with different kinds of IO streams."""
|
94
pr_5251-pytest5.patch
Normal file
94
pr_5251-pytest5.patch
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
From 9da8a963868c1019fb02691c54c493ca1549e6bb Mon Sep 17 00:00:00 2001
|
||||||
|
From: John Vandenberg <jayvdb@gmail.com>
|
||||||
|
Date: Fri, 1 Nov 2019 14:04:43 +0700
|
||||||
|
Subject: [PATCH 1/2] test_requests: Support pytest assert rewriting
|
||||||
|
|
||||||
|
The real exception has moved to e.value, when pytest
|
||||||
|
wraps the exception, however it wasnt wrapped in one
|
||||||
|
case for pytest 3, so add backwards compatibility.
|
||||||
|
---
|
||||||
|
tests/test_requests.py | 12 +++++++-----
|
||||||
|
1 file changed, 7 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tests/test_requests.py b/tests/test_requests.py
|
||||||
|
index 7d4a4eb51..75366d10b 100644
|
||||||
|
--- a/tests/test_requests.py
|
||||||
|
+++ b/tests/test_requests.py
|
||||||
|
@@ -1692,7 +1692,7 @@ def __iter__(self):
|
||||||
|
with pytest.raises(UnrewindableBodyError) as e:
|
||||||
|
requests.utils.rewind_body(prep)
|
||||||
|
|
||||||
|
- assert 'Unable to rewind request body' in str(e)
|
||||||
|
+ assert 'Unable to rewind request body' in str(e.value)
|
||||||
|
|
||||||
|
def test_rewind_body_failed_seek(self):
|
||||||
|
class BadFileObj:
|
||||||
|
@@ -1715,7 +1715,7 @@ def __iter__(self):
|
||||||
|
with pytest.raises(UnrewindableBodyError) as e:
|
||||||
|
requests.utils.rewind_body(prep)
|
||||||
|
|
||||||
|
- assert 'error occurred when rewinding request body' in str(e)
|
||||||
|
+ assert 'error occurred when rewinding request body' in str(e.value)
|
||||||
|
|
||||||
|
def test_rewind_body_failed_tell(self):
|
||||||
|
class BadFileObj:
|
||||||
|
@@ -1735,7 +1735,7 @@ def __iter__(self):
|
||||||
|
with pytest.raises(UnrewindableBodyError) as e:
|
||||||
|
requests.utils.rewind_body(prep)
|
||||||
|
|
||||||
|
- assert 'Unable to rewind request body' in str(e)
|
||||||
|
+ assert 'Unable to rewind request body' in str(e.value)
|
||||||
|
|
||||||
|
def _patch_adapter_gzipped_redirect(self, session, url):
|
||||||
|
adapter = session.get_adapter(url=url)
|
||||||
|
@@ -2155,7 +2155,7 @@ def test_stream_timeout(self, httpbin):
|
||||||
|
def test_invalid_timeout(self, httpbin, timeout, error_text):
|
||||||
|
with pytest.raises(ValueError) as e:
|
||||||
|
requests.get(httpbin('get'), timeout=timeout)
|
||||||
|
- assert error_text in str(e)
|
||||||
|
+ assert error_text in str(e.value)
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
'timeout', (
|
||||||
|
@@ -2374,7 +2374,9 @@ def test_urllib3_pool_connection_closed(httpbin):
|
||||||
|
try:
|
||||||
|
s.get(httpbin('status/200'))
|
||||||
|
except ConnectionError as e:
|
||||||
|
- assert u"Pool is closed." in str(e)
|
||||||
|
+ # pytest only sometimes wraps this exception
|
||||||
|
+ real_exception = e.value if hasattr(e, 'value') else e
|
||||||
|
+ assert u"Pool is closed." in str(real_exception)
|
||||||
|
|
||||||
|
|
||||||
|
class TestPreparingURLs(object):
|
||||||
|
|
||||||
|
From 119735dfef516ae33c89a9230653f91968444aa9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: John Vandenberg <jayvdb@gmail.com>
|
||||||
|
Date: Fri, 1 Nov 2019 13:16:34 +0700
|
||||||
|
Subject: [PATCH 2/2] test_conflicting_post_params: Update pytest.raises
|
||||||
|
|
||||||
|
Move logic out of string passed to pytest.raises, into
|
||||||
|
the context of pytest.raises, as pytest no longer
|
||||||
|
supports pytest.raises execution of strings.
|
||||||
|
---
|
||||||
|
tests/test_requests.py | 7 +++++--
|
||||||
|
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tests/test_requests.py b/tests/test_requests.py
|
||||||
|
index 75366d10b..9554f39af 100644
|
||||||
|
--- a/tests/test_requests.py
|
||||||
|
+++ b/tests/test_requests.py
|
||||||
|
@@ -774,8 +774,11 @@ def __len__(self):
|
||||||
|
def test_conflicting_post_params(self, httpbin):
|
||||||
|
url = httpbin('post')
|
||||||
|
with open('Pipfile') as f:
|
||||||
|
- pytest.raises(ValueError, "requests.post(url, data='[{\"some\": \"data\"}]', files={'some': f})")
|
||||||
|
- pytest.raises(ValueError, "requests.post(url, data=u('[{\"some\": \"data\"}]'), files={'some': f})")
|
||||||
|
+ with pytest.raises(ValueError):
|
||||||
|
+ requests.post(url, data='[{\"some\": \"data\"}]', files={'some': f})
|
||||||
|
+
|
||||||
|
+ with pytest.raises(ValueError):
|
||||||
|
+ requests.post(url, data=u('[{\"some\": \"data\"}]'), files={'some': f})
|
||||||
|
|
||||||
|
def test_request_ok_set(self, httpbin):
|
||||||
|
r = requests.get(httpbin('status', '404'))
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Nov 1 07:57:29 UTC 2019 - John Vandenberg <jayvdb@gmail.com>
|
||||||
|
|
||||||
|
- Add two patches only updating test logic to remove pytest 3 pin
|
||||||
|
- merged_pr_5049.patch
|
||||||
|
- pr_5251-pytest5.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Jul 22 07:57:59 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
|
Mon Jul 22 07:57:59 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
|
||||||
|
|
||||||
|
@ -35,6 +35,8 @@ URL: http://python-requests.org/
|
|||||||
Source: https://files.pythonhosted.org/packages/source/r/requests/requests-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/r/requests/requests-%{version}.tar.gz
|
||||||
# PATCH-FIX-SUSE: do not hardcode versions in setup.py/requirements
|
# PATCH-FIX-SUSE: do not hardcode versions in setup.py/requirements
|
||||||
Patch0: requests-no-hardcoded-version.patch
|
Patch0: requests-no-hardcoded-version.patch
|
||||||
|
Patch1: pr_5251-pytest5.patch
|
||||||
|
Patch2: merged_pr_5049.patch
|
||||||
BuildRequires: %{python_module certifi}
|
BuildRequires: %{python_module certifi}
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
BuildRequires: %{python_module urllib3 >= 1.21.1}
|
BuildRequires: %{python_module urllib3 >= 1.21.1}
|
||||||
@ -66,9 +68,9 @@ BuildRequires: %{python_module PySocks >= 1.5.6}
|
|||||||
BuildRequires: %{python_module brotlipy}
|
BuildRequires: %{python_module brotlipy}
|
||||||
BuildRequires: %{python_module chardet >= 3.0.2}
|
BuildRequires: %{python_module chardet >= 3.0.2}
|
||||||
BuildRequires: %{python_module idna >= 2.5}
|
BuildRequires: %{python_module idna >= 2.5}
|
||||||
BuildRequires: %{python_module pytest < 4.0}
|
|
||||||
BuildRequires: %{python_module pytest-httpbin >= 0.0.7}
|
BuildRequires: %{python_module pytest-httpbin >= 0.0.7}
|
||||||
BuildRequires: %{python_module pytest-mock}
|
BuildRequires: %{python_module pytest-mock}
|
||||||
|
BuildRequires: %{python_module pytest}
|
||||||
BuildRequires: %{python_module requests >= %{version}}
|
BuildRequires: %{python_module requests >= %{version}}
|
||||||
%endif
|
%endif
|
||||||
%python_subpackages
|
%python_subpackages
|
||||||
@ -93,7 +95,7 @@ Features of Requests:
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n requests-%{version}
|
%setup -q -n requests-%{version}
|
||||||
%patch0 -p1
|
%autopatch -p1
|
||||||
|
|
||||||
# drop shebang from certs.py
|
# drop shebang from certs.py
|
||||||
sed -i '1s/^#!.*$//' requests/certs.py
|
sed -i '1s/^#!.*$//' requests/certs.py
|
||||||
|
Loading…
Reference in New Issue
Block a user