python-urllib3/1414.patch
Ondřej Súkup dc3d451550 Accepting request 622951 from home:mimi_vx:branches:devel:languages:python
- update to 1.23
- add 1414.patch - fix tests with new tornado
- refresh python-urllib3-recent-date.patch
- drop urllib3-test-no-coverage.patch
 * Allow providing a list of headers to strip from requests when redirecting 
   to a different host. Defaults to the Authorization header. Different
   headers can be set via Retry.remove_headers_on_redirect.
 * Fix util.selectors._fileobj_to_fd to accept long
 * Dropped Python 3.3 support.
 * Put the connection back in the pool when calling stream()
   or read_chunked() on a chunked HEAD response.
 * Fixed pyOpenSSL-specific ssl client authentication issue when clients
   attempted to auth via certificate + chain
 * Add the port to the connectionpool connect print
 * Don't use the uuid module to create multipart data boundaries.
 * read_chunked() on a closed response returns no chunks.
 * Add Python 2.6 support to contrib.securetransport
 * Added support for auth info in url for SOCKS proxy

OBS-URL: https://build.opensuse.org/request/show/622951
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-urllib3?expand=0&rev=40
2018-07-15 22:34:22 +00:00

84 lines
3.2 KiB
Diff

From f8c3e96df731eccda202e0dc909f0a51cdc41267 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Sat, 14 Jul 2018 12:21:50 +0200
Subject: [PATCH 1/2] dummyserver: Update for tornado-5 API changes
Tornado 5 has apparently removed support for multiple IOLoops,
and appropriately removed the io_loop parameter to the server class
in favor of using IOLoop.current(). Update the tests to use the latter.
The code remains compatible with tornado-4.
---
dummyserver/server.py | 9 +++++----
dummyserver/testcase.py | 4 ++--
2 files changed, 7 insertions(+), 6 deletions(-)
Index: urllib3-1.23/dummyserver/server.py
===================================================================
--- urllib3-1.23.orig/dummyserver/server.py
+++ urllib3-1.23/dummyserver/server.py
@@ -226,15 +226,16 @@ def bind_sockets(port, address=None, fam
def run_tornado_app(app, io_loop, certs, scheme, host):
+ assert io_loop == tornado.ioloop.IOLoop.current()
+
# We can't use fromtimestamp(0) because of CPython issue 29097, so we'll
# just construct the datetime object directly.
app.last_req = datetime(1970, 1, 1)
if scheme == 'https':
- http_server = tornado.httpserver.HTTPServer(app, ssl_options=certs,
- io_loop=io_loop)
+ http_server = tornado.httpserver.HTTPServer(app, ssl_options=certs)
else:
- http_server = tornado.httpserver.HTTPServer(app, io_loop=io_loop)
+ http_server = tornado.httpserver.HTTPServer(app)
sockets = bind_sockets(None, address=host)
port = sockets[0].getsockname()[1]
@@ -268,7 +269,7 @@ if __name__ == '__main__':
from .testcase import TestingApp
host = '127.0.0.1'
- io_loop = tornado.ioloop.IOLoop()
+ io_loop = tornado.ioloop.IOLoop.current()
app = tornado.web.Application([(r".*", TestingApp)])
server, port = run_tornado_app(app, io_loop, None,
'http', host)
Index: urllib3-1.23/dummyserver/testcase.py
===================================================================
--- urllib3-1.23.orig/dummyserver/testcase.py
+++ urllib3-1.23/dummyserver/testcase.py
@@ -124,7 +124,7 @@ class HTTPDummyServerTestCase(unittest.T
@classmethod
def _start_server(cls):
- cls.io_loop = ioloop.IOLoop()
+ cls.io_loop = ioloop.IOLoop.current()
app = web.Application([(r".*", TestingApp)])
cls.server, cls.port = run_tornado_app(app, cls.io_loop, cls.certs,
cls.scheme, cls.host)
@@ -170,7 +170,7 @@ class HTTPDummyProxyTestCase(unittest.Te
@classmethod
def setUpClass(cls):
- cls.io_loop = ioloop.IOLoop()
+ cls.io_loop = ioloop.IOLoop.current()
app = web.Application([(r'.*', TestingApp)])
cls.http_server, cls.http_port = run_tornado_app(
Index: urllib3-1.23/dev-requirements.txt
===================================================================
--- urllib3-1.23.orig/dev-requirements.txt
+++ urllib3-1.23/dev-requirements.txt
@@ -3,7 +3,8 @@ coverage==3.7.1
tox==2.1.1
twine==1.5.0
wheel==0.24.0
-tornado==4.2.1
+tornado==5.0.2; python_version>"2.6"
+tornado==4.2.1; python_version<="2.6"
PySocks==1.5.6
pkginfo>=1.0,!=1.3.0
psutil==4.3.1