Accepting request 345102 from devel:languages:python
- removed python-certifi dependency, we don't want to use it - drop 0001-Don-t-pin-dependency-to-exact-version.patch because it's not needed anymore - re-enable tests, re-add relevant dependencies * don't exclude test_util.py * exclude proxy timeout tests that fail for spurious reasons - urllib3-ssl-default-context.patch - use set_default_verify_paths() if no certificate path specified and verification not explicitly disabled - urllib3-test-ssl-drop-sslv3.patch - don't use "SSLv3" constants in python 2.7.9 and up - ready-event.patch - fix race conditions in timeout tests - drop %pre section because apparently "egg-info as file" is no longer true and this breaks builds OBS-URL: https://build.opensuse.org/request/show/345102 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-urllib3?expand=0&rev=6
This commit is contained in:
commit
8af9d6b346
@ -1,37 +0,0 @@
|
||||
From c8ce46178f97cc765a569864302b75aaa730d590 Mon Sep 17 00:00:00 2001
|
||||
From: Sascha Peilicke <saschpe@mailbox.org>
|
||||
Date: Thu, 20 Mar 2014 15:35:51 +0100
|
||||
Subject: [PATCH] Don't pin dependency to exact version
|
||||
|
||||
While this expresses with which versions urllib3 is tested to work with,
|
||||
almost all distros ship different package versions. To accomodate that
|
||||
(and to avoid having them to patch away these hard requirements) only
|
||||
use '>='.
|
||||
---
|
||||
test-requirements.txt | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dev-requirements.txt b/dev-requirements.txt
|
||||
index 02d70f4..98de1cc 100644
|
||||
--- a/dev-requirements.txt
|
||||
+++ b/dev-requirements.txt
|
||||
@@ -1,8 +1,8 @@
|
||||
-nose==1.3.7
|
||||
-nose-exclude==0.4.1
|
||||
-mock==1.3.0
|
||||
-coverage==3.7.1
|
||||
-tox==2.1.1
|
||||
-twine==1.5.0
|
||||
-wheel==0.24.0
|
||||
-tornado==4.2.1
|
||||
+nose>=1.3.7
|
||||
+nose-exclude>=0.4.1
|
||||
+mock>=1.3.0
|
||||
+coverage>=3.7.1
|
||||
+tox>=2.1.1
|
||||
+twine>=1.5.0
|
||||
+wheel>=0.24.0
|
||||
+tornado>=4.2.1
|
||||
--
|
||||
1.9.0
|
||||
|
@ -1,3 +1,22 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 27 16:33:44 UTC 2015 - jmatejek@suse.com
|
||||
|
||||
- removed python-certifi dependency, we don't want to use it
|
||||
- drop 0001-Don-t-pin-dependency-to-exact-version.patch because it's
|
||||
not needed anymore
|
||||
- re-enable tests, re-add relevant dependencies
|
||||
* don't exclude test_util.py
|
||||
* exclude proxy timeout tests that fail for spurious reasons
|
||||
- urllib3-ssl-default-context.patch - use set_default_verify_paths()
|
||||
if no certificate path specified and verification not explicitly
|
||||
disabled
|
||||
- urllib3-test-ssl-drop-sslv3.patch - don't use "SSLv3" constants
|
||||
in python 2.7.9 and up
|
||||
- ready-event.patch - fix race conditions in timeout tests
|
||||
- drop %pre section because apparently "egg-info as file" is no longer
|
||||
true and this breaks builds
|
||||
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Oct 14 09:35:30 UTC 2015 - toddrme2178@gmail.com
|
||||
|
||||
|
@ -24,12 +24,20 @@ License: MIT
|
||||
Group: Development/Languages/Python
|
||||
Url: http://urllib3.readthedocs.org/
|
||||
Source: https://pypi.python.org/packages/source/u/urllib3/urllib3-%{version}.tar.gz
|
||||
# PATCH-FIX-UPSTREAM speilicke@suse.com -- https://github.com/shazow/urllib3/pull/361
|
||||
Patch0: 0001-Don-t-pin-dependency-to-exact-version.patch
|
||||
# PATCH-FIX-OPENSUSE speilicke@suse.com -- We need no coverage report
|
||||
Patch1: urllib3-test-no-coverage.patch
|
||||
# PATCH-FEATURE-UPSTREAM -- use set_default_verify_paths() if no certificate path is supplied
|
||||
Patch2: urllib3-ssl-default-context.patch
|
||||
# PATCH-FIX-OPENSUSE -- do not use unsupported SSLv3 in tests
|
||||
Patch3: urllib3-test-ssl-drop-sslv3.patch
|
||||
# PATCH-FIX-UPSTREAM -- fix race conditions with ready_event state variable in timeout tests
|
||||
Patch4: ready-event.patch
|
||||
#!BuildIgnore: python-requests
|
||||
BuildRequires: python-devel
|
||||
Requires: python-certifi
|
||||
BuildRequires: python-mock >= 1.3.0
|
||||
BuildRequires: python-nose >= 1.3.7
|
||||
BuildRequires: python-nose-exclude >= 0.4.1
|
||||
BuildRequires: python-tornado >= 4.2.1
|
||||
Requires: python-pyOpenSSL
|
||||
Requires: python-pyasn1
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
@ -57,8 +65,12 @@ Highlights
|
||||
|
||||
%prep
|
||||
%setup -q -n urllib3-%{version}
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%if %(python -c "import ssl; print(hasattr(ssl,'PROTOCOL_TLSv1_2'))") == "True"
|
||||
%patch3 -p1
|
||||
%endif
|
||||
%patch4 -p1
|
||||
|
||||
%build
|
||||
python setup.py build
|
||||
@ -66,12 +78,18 @@ python setup.py build
|
||||
%install
|
||||
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
|
||||
|
||||
%pre
|
||||
%check
|
||||
rm -rf build
|
||||
PYTHONPATH="%{buildroot}%{python_sitelib}" nosetests \
|
||||
--exclude-test=test.with_dummyserver.test_proxy_poolmanager.TestHTTPProxyManager.test_https_proxy_timeout \
|
||||
--exclude-test=test.with_dummyserver.test_proxy_poolmanager.TestHTTPProxyManager.test_https_proxy_pool_timeout
|
||||
|
||||
#%pre
|
||||
# previous versions of the package installed .egg-info as a directory,
|
||||
# the new update now installs it as a file. Clean out the directory, should it exist.
|
||||
if [ -d %{python_sitelib}/urllib3-%{version}-py*.egg-info ]; then
|
||||
rm -rf %{python_sitelib}/urllib3-%{version}-py*.egg-info
|
||||
fi
|
||||
#if [ -d %{python_sitelib}/urllib3-%{version}-py*.egg-info ]; then
|
||||
# rm -rf %{python_sitelib}/urllib3-%{version}-py*.egg-info
|
||||
#fi
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
|
106
ready-event.patch
Normal file
106
ready-event.patch
Normal file
@ -0,0 +1,106 @@
|
||||
Index: urllib3-1.12/dummyserver/testcase.py
|
||||
===================================================================
|
||||
--- urllib3-1.12.orig/dummyserver/testcase.py
|
||||
+++ urllib3-1.12/dummyserver/testcase.py
|
||||
@@ -45,7 +45,7 @@ class SocketDummyServerTestCase(unittest
|
||||
def socket_handler(listener):
|
||||
for _ in range(num):
|
||||
ready_event.set()
|
||||
- ready_event.clear()
|
||||
+ #ready_event.clear()
|
||||
|
||||
sock = listener.accept()[0]
|
||||
consume_socket(sock)
|
||||
@@ -59,6 +59,11 @@ class SocketDummyServerTestCase(unittest
|
||||
return ready_event
|
||||
|
||||
@classmethod
|
||||
+ def wait_for_socket(cls, ready_event):
|
||||
+ ready_event.wait()
|
||||
+ ready_event.clear()
|
||||
+
|
||||
+ @classmethod
|
||||
def start_basic_handler(cls, **kw):
|
||||
return cls.start_response_handler(
|
||||
b'HTTP/1.1 200 OK\r\n'
|
||||
Index: urllib3-1.12/test/with_dummyserver/test_connectionpool.py
|
||||
===================================================================
|
||||
--- urllib3-1.12.orig/test/with_dummyserver/test_connectionpool.py
|
||||
+++ urllib3-1.12/test/with_dummyserver/test_connectionpool.py
|
||||
@@ -57,11 +57,12 @@ class TestConnectionPoolTimeouts(SocketD
|
||||
|
||||
# Pool-global timeout
|
||||
pool = HTTPConnectionPool(self.host, self.port, timeout=SHORT_TIMEOUT, retries=False)
|
||||
+ self.wait_for_socket(ready_event)
|
||||
self.assertRaises(ReadTimeoutError, pool.request, 'GET', '/')
|
||||
block_event.set() # Release block
|
||||
|
||||
# Shouldn't raise this time
|
||||
- ready_event.wait()
|
||||
+ self.wait_for_socket(ready_event)
|
||||
block_event.set() # Pre-release block
|
||||
pool.request('GET', '/')
|
||||
|
||||
@@ -92,12 +93,13 @@ class TestConnectionPoolTimeouts(SocketD
|
||||
timeout = Timeout(read=SHORT_TIMEOUT)
|
||||
pool = HTTPConnectionPool(self.host, self.port, timeout=timeout, retries=False)
|
||||
|
||||
+ self.wait_for_socket(ready_event)
|
||||
conn = pool._get_conn()
|
||||
self.assertRaises(ReadTimeoutError, pool._make_request, conn, 'GET', '/')
|
||||
pool._put_conn(conn)
|
||||
block_event.set() # Release request
|
||||
|
||||
- ready_event.wait()
|
||||
+ self.wait_for_socket(ready_event)
|
||||
block_event.clear()
|
||||
self.assertRaises(ReadTimeoutError, pool.request, 'GET', '/')
|
||||
block_event.set() # Release request
|
||||
@@ -106,7 +108,7 @@ class TestConnectionPoolTimeouts(SocketD
|
||||
pool = HTTPConnectionPool(self.host, self.port, timeout=LONG_TIMEOUT, retries=False)
|
||||
|
||||
conn = pool._get_conn()
|
||||
- ready_event.wait()
|
||||
+ self.wait_for_socket(ready_event)
|
||||
now = time.time()
|
||||
self.assertRaises(ReadTimeoutError, pool._make_request, conn, 'GET', '/', timeout=timeout)
|
||||
delta = time.time() - now
|
||||
@@ -115,7 +117,7 @@ class TestConnectionPoolTimeouts(SocketD
|
||||
self.assertTrue(delta < LONG_TIMEOUT, "timeout was pool-level LONG_TIMEOUT rather than request-level SHORT_TIMEOUT")
|
||||
pool._put_conn(conn)
|
||||
|
||||
- ready_event.wait()
|
||||
+ self.wait_for_socket(ready_event)
|
||||
now = time.time()
|
||||
self.assertRaises(ReadTimeoutError, pool.request, 'GET', '/', timeout=timeout)
|
||||
delta = time.time() - now
|
||||
@@ -125,11 +127,11 @@ class TestConnectionPoolTimeouts(SocketD
|
||||
|
||||
# Timeout int/float passed directly to request and _make_request should
|
||||
# raise a request timeout
|
||||
- ready_event.wait()
|
||||
+ self.wait_for_socket(ready_event)
|
||||
self.assertRaises(ReadTimeoutError, pool.request, 'GET', '/', timeout=SHORT_TIMEOUT)
|
||||
block_event.set() # Release request
|
||||
|
||||
- ready_event.wait()
|
||||
+ self.wait_for_socket(ready_event)
|
||||
conn = pool._new_conn()
|
||||
# FIXME: This assert flakes sometimes. Not sure why.
|
||||
self.assertRaises(ReadTimeoutError, pool._make_request, conn, 'GET', '/', timeout=SHORT_TIMEOUT)
|
||||
@@ -183,13 +185,14 @@ class TestConnectionPoolTimeouts(SocketD
|
||||
block_event = Event()
|
||||
ready_event = self.start_basic_handler(block_send=block_event, num=2)
|
||||
|
||||
+ self.wait_for_socket(ready_event)
|
||||
# This will get the socket to raise an EAGAIN on the read
|
||||
timeout = Timeout(connect=3, read=SHORT_TIMEOUT)
|
||||
pool = HTTPConnectionPool(self.host, self.port, timeout=timeout, retries=False)
|
||||
self.assertRaises(ReadTimeoutError, pool.request, 'GET', '/')
|
||||
|
||||
block_event.set()
|
||||
- ready_event.wait()
|
||||
+ self.wait_for_socket(ready_event)
|
||||
block_event.clear()
|
||||
|
||||
# The connect should succeed and this should hit the read timeout
|
13
urllib3-ssl-default-context.patch
Normal file
13
urllib3-ssl-default-context.patch
Normal file
@ -0,0 +1,13 @@
|
||||
Index: urllib3-1.12/urllib3/util/ssl_.py
|
||||
===================================================================
|
||||
--- urllib3-1.12.orig/urllib3/util/ssl_.py
|
||||
+++ urllib3-1.12/urllib3/util/ssl_.py
|
||||
@@ -278,6 +278,8 @@ def ssl_wrap_socket(sock, keyfile=None,
|
||||
if e.errno == errno.ENOENT:
|
||||
raise SSLError(e)
|
||||
raise
|
||||
+ elif cert_reqs != ssl.CERT_NONE and hasattr(context, 'set_default_verify_paths'):
|
||||
+ context.set_default_verify_paths()
|
||||
|
||||
if certfile:
|
||||
context.load_cert_chain(certfile, keyfile)
|
31
urllib3-test-ssl-drop-sslv3.patch
Normal file
31
urllib3-test-ssl-drop-sslv3.patch
Normal file
@ -0,0 +1,31 @@
|
||||
Index: urllib3-1.12/test/with_dummyserver/test_https.py
|
||||
===================================================================
|
||||
--- urllib3-1.12.orig/test/with_dummyserver/test_https.py
|
||||
+++ urllib3-1.12/test/with_dummyserver/test_https.py
|
||||
@@ -416,21 +416,21 @@ class TestHTTPS(HTTPSDummyServerTestCase
|
||||
|
||||
class TestHTTPS_TLSv1(HTTPSDummyServerTestCase):
|
||||
certs = DEFAULT_CERTS.copy()
|
||||
- certs['ssl_version'] = ssl.PROTOCOL_TLSv1
|
||||
+ certs['ssl_version'] = ssl.PROTOCOL_TLSv1_2
|
||||
|
||||
def setUp(self):
|
||||
self._pool = HTTPSConnectionPool(self.host, self.port)
|
||||
|
||||
- def test_set_ssl_version_to_sslv3(self):
|
||||
- self._pool.ssl_version = ssl.PROTOCOL_SSLv3
|
||||
+ def test_set_ssl_version_to_tlsv1(self):
|
||||
+ self._pool.ssl_version = ssl.PROTOCOL_TLSv1
|
||||
self.assertRaises(SSLError, self._pool.request, 'GET', '/')
|
||||
|
||||
def test_ssl_version_as_string(self):
|
||||
- self._pool.ssl_version = 'PROTOCOL_SSLv3'
|
||||
+ self._pool.ssl_version = 'PROTOCOL_TLSv1'
|
||||
self.assertRaises(SSLError, self._pool.request, 'GET', '/')
|
||||
|
||||
def test_ssl_version_as_short_string(self):
|
||||
- self._pool.ssl_version = 'SSLv3'
|
||||
+ self._pool.ssl_version = 'TLSv1'
|
||||
self.assertRaises(SSLError, self._pool.request, 'GET', '/')
|
||||
|
||||
def test_discards_connection_on_sslerror(self):
|
Loading…
x
Reference in New Issue
Block a user