Backport patch for Python 3.7 support (rhbz 1584112)

Since it's not clear when urllib3 will get a new release, fix the Python
3.7 test failures now.
This commit is contained in:
Jeremy Cline 2018-05-30 08:58:59 -04:00
parent d2ba833e15
commit 0905637ec9
No known key found for this signature in database
GPG Key ID: 9223308FA9B246DB
2 changed files with 34 additions and 2 deletions

View File

@ -0,0 +1,26 @@
From edd7a0063d25f1a7f34306f9a9488247593888a9 Mon Sep 17 00:00:00 2001
From: Chris Wilcox <crwilcox@google.com>
Date: Fri, 20 Apr 2018 15:50:40 -0700
Subject: [PATCH] Address #1365. CertificateError str repr is tuple, not str.
Signed-off-by: Jeremy Cline <jcline@redhat.com>
---
test/test_connection.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/test_connection.py b/test/test_connection.py
index be50f6c..dfc757d 100644
--- a/test/test_connection.py
+++ b/test/test_connection.py
@@ -38,7 +38,7 @@ class TestConnection(object):
with mock.patch('urllib3.connection.log.error') as mock_log:
_match_hostname(cert, asserted_hostname)
except CertificateError as e:
- assert str(e) == "hostname 'bar' doesn't match 'foo'"
+ assert "hostname 'bar' doesn't match 'foo'" in str(e)
mock_log.assert_called_once_with(
'Certificate did not match expected hostname: %s. '
'Certificate: %s',
--
2.17.0

View File

@ -5,7 +5,7 @@
Name: python-%{srcname}
Version: 1.22
Release: 9%{?dist}
Release: 10%{?dist}
Summary: Python HTTP library with thread-safe connection pooling and file post
License: MIT
@ -16,7 +16,9 @@ Source1: ssl_match_hostname_py3.py
# https://github.com/shazow/urllib3/commit/4bff1e93d2dd4663d422d7e290473d9189cec5db
Patch0: python-urllib3-recent-date.patch
# https://github.com/urllib3/urllib3/commit/9f09cb4b9d69bd8944c881f61b8fe933ad425b5b
Patch0001: 0001-Do-not-lowercase-hostnames-with-custom-protocol.patch
Patch1: 0001-Do-not-lowercase-hostnames-with-custom-protocol.patch
# https://github.com/urllib3/urllib3/pull/1375 - Python 3.7 support
Patch2: Address-1365.-CertificateError-str-repr-is-tuple-not.patch
BuildArch: noarch
%description
@ -79,6 +81,7 @@ Python3 HTTP module with connection pooling and file POST abilities.
%setup -q -n %{srcname}-%{version}
%patch0 -p1 -b .recent-date
%patch1 -p1
%patch2 -p1
# Drop the dummyserver tests in koji. They fail there in real builds, but not
# in scratch builds (weird).
rm -rf test/with_dummyserver/
@ -145,6 +148,9 @@ py.test-3
%changelog
* Wed May 30 2018 Jeremy Cline <jeremy@jcline.org> - 1.22-10
- Backport patch to support Python 3.7 (rhbz 1584112)
* Thu May 03 2018 Lukas Slebodnik <lslebodn@fedoraproject.org> - 1.22-9
- Do not lowercase hostnames with custom-protocol (rhbz 1567862)
- upstream: https://github.com/urllib3/urllib3/issues/1267