Accepting request 855865 from devel:languages:python

- If you skip_python2 you don't need mock.
- We don't need to break Python 2.7
- Add remove_mock.patch to remove dependency on the external mock
  package (gh#urllib3/urllib3#2108).
- Fixed the testsuite and updated dependencies
- update to 1.26.2:
  * Fixed an issue where ``wrap_socket`` and ``CERT_REQUIRED`` wouldn't
    be imported properly on Python 2.7.8 and earlier (Pull #2052)
  * Fixed an issue where two ``User-Agent`` headers would be sent if a
    ``User-Agent`` header key is passed as ``bytes`` (Pull #2047)
  * Added support for HTTPS proxies contacting HTTPS servers (Pull #1923, Pull #1806)
  * Deprecated negotiating TLSv1 and TLSv1.1 by default. Users that
    still wish to use TLS earlier than 1.2 without a deprecation warning
    should opt-in explicitly by setting ``ssl_version=ssl.PROTOCOL_TLSv1_1`` (Pull #2002)
    **Starting in urllib3 v2.0: Connections that receive a ``DeprecationWarning`` will fail**
  * Deprecated ``Retry`` options ``Retry.DEFAULT_METHOD_WHITELIST``, ``Retry.DEFAULT_REDIRECT_HEADERS_BLACKLIST``
    and ``Retry(method_whitelist=...)`` in favor of ``Retry.DEFAULT_ALLOWED_METHODS``,
    ``Retry.DEFAULT_REMOVE_HEADERS_ON_REDIRECT``, and ``Retry(allowed_methods=...)``
    (Pull #2000) **Starting in urllib3 v2.0: Deprecated options will be removed**
  * Added default ``User-Agent`` header to every request (Pull #1750)
  * Added ``urllib3.util.SKIP_HEADER`` for skipping ``User-Agent``, ``Accept-Encoding``, 
    and ``Host`` headers from being automatically emitted with requests (Pull #2018)
  * Collapse ``transfer-encoding: chunked`` request data and framing into
    the same ``socket.send()`` call (Pull #1906)
  * Send ``http/1.1`` ALPN identifier with every TLS handshake by default (Pull #1894)
  * Properly terminate SecureTransport connections when CA verification fails (Pull #1977)
  * Don't emit an ``SNIMissingWarning`` when passing ``server_hostname=None``
    to SecureTransport (Pull #1903)
  * Disabled requesting TLSv1.2 session tickets as they weren't being used by urllib3 (Pull #1970)
  * Suppress ``BrokenPipeError`` when writing request body after the server
    has closed the socket (Pull #1524)
  * Wrap ``ssl.SSLError`` that can be raised from reading a socket (e.g. "bad MAC")
    into an ``urllib3.exceptions.SSLError`` (Pull #1939)
  * Fix retry backoff time parsed from ``Retry-After`` header when given
    in the HTTP date format. The HTTP date was parsed as the local timezone
    rather than accounting for the timezone in the HTTP date (typically
    UTC) (Pull #1932, Pull #1935, Pull #1938, Pull #1949)

OBS-URL: https://build.opensuse.org/request/show/855865
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-urllib3?expand=0&rev=42
This commit is contained in:
Dominique Leuenberger 2020-12-16 09:59:57 +00:00 committed by Git OBS Bridge
commit 7f246b4425
5 changed files with 311 additions and 28 deletions

View File

@ -1,3 +1,60 @@
-------------------------------------------------------------------
Mon Dec 14 15:21:26 UTC 2020 - Benjamin Greiner <code@bnavigator.de>
- If you skip_python2 you don't need mock.
-------------------------------------------------------------------
Sun Dec 13 21:46:22 UTC 2020 - Matej Cepl <mcepl@suse.com>
- We don't need to break Python 2.7
-------------------------------------------------------------------
Fri Dec 11 22:52:59 UTC 2020 - Matej Cepl <mcepl@suse.com>
- Add remove_mock.patch to remove dependency on the external mock
package (gh#urllib3/urllib3#2108).
-------------------------------------------------------------------
Fri Dec 11 14:18:57 UTC 2020 - Markéta Machová <mmachova@suse.com>
- Fixed the testsuite and updated dependencies
-------------------------------------------------------------------
Thu Nov 26 09:02:30 UTC 2020 - Dirk Mueller <dmueller@suse.com>
- update to 1.26.2:
* Fixed an issue where ``wrap_socket`` and ``CERT_REQUIRED`` wouldn't
be imported properly on Python 2.7.8 and earlier (Pull #2052)
* Fixed an issue where two ``User-Agent`` headers would be sent if a
``User-Agent`` header key is passed as ``bytes`` (Pull #2047)
* Added support for HTTPS proxies contacting HTTPS servers (Pull #1923, Pull #1806)
* Deprecated negotiating TLSv1 and TLSv1.1 by default. Users that
still wish to use TLS earlier than 1.2 without a deprecation warning
should opt-in explicitly by setting ``ssl_version=ssl.PROTOCOL_TLSv1_1`` (Pull #2002)
**Starting in urllib3 v2.0: Connections that receive a ``DeprecationWarning`` will fail**
* Deprecated ``Retry`` options ``Retry.DEFAULT_METHOD_WHITELIST``, ``Retry.DEFAULT_REDIRECT_HEADERS_BLACKLIST``
and ``Retry(method_whitelist=...)`` in favor of ``Retry.DEFAULT_ALLOWED_METHODS``,
``Retry.DEFAULT_REMOVE_HEADERS_ON_REDIRECT``, and ``Retry(allowed_methods=...)``
(Pull #2000) **Starting in urllib3 v2.0: Deprecated options will be removed**
* Added default ``User-Agent`` header to every request (Pull #1750)
* Added ``urllib3.util.SKIP_HEADER`` for skipping ``User-Agent``, ``Accept-Encoding``,
and ``Host`` headers from being automatically emitted with requests (Pull #2018)
* Collapse ``transfer-encoding: chunked`` request data and framing into
the same ``socket.send()`` call (Pull #1906)
* Send ``http/1.1`` ALPN identifier with every TLS handshake by default (Pull #1894)
* Properly terminate SecureTransport connections when CA verification fails (Pull #1977)
* Don't emit an ``SNIMissingWarning`` when passing ``server_hostname=None``
to SecureTransport (Pull #1903)
* Disabled requesting TLSv1.2 session tickets as they weren't being used by urllib3 (Pull #1970)
* Suppress ``BrokenPipeError`` when writing request body after the server
has closed the socket (Pull #1524)
* Wrap ``ssl.SSLError`` that can be raised from reading a socket (e.g. "bad MAC")
into an ``urllib3.exceptions.SSLError`` (Pull #1939)
* Fix retry backoff time parsed from ``Retry-After`` header when given
in the HTTP date format. The HTTP date was parsed as the local timezone
rather than accounting for the timezone in the HTTP date (typically
UTC) (Pull #1932, Pull #1935, Pull #1938, Pull #1949)
-------------------------------------------------------------------
Wed Sep 9 16:49:22 UTC 2020 - Alberto Planas Dominguez <aplanas@suse.com>

View File

@ -18,7 +18,6 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
%define oldpython python
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
@ -28,7 +27,7 @@
%bcond_with test
%endif
Name: python-urllib3%{psuffix}
Version: 1.25.10
Version: 1.26.2
Release: 0
Summary: HTTP library with thread-safe connection pooling, file post, and more
License: MIT
@ -37,6 +36,9 @@ URL: https://urllib3.readthedocs.org/
Source: https://files.pythonhosted.org/packages/source/u/urllib3/urllib3-%{version}.tar.gz
# Wrapper for ssl to unbundle ssl_match_hostname
Source1: ssl_match_hostname_py3.py
# PATCH-FIX-UPSTREAM remove_mock.patch gh#urllib3/urllib3#2108 mcepl@suse.com
# remove dependency on the external module mock
Patch0: remove_mock.patch
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module six}
BuildRequires: fdupes
@ -46,29 +48,29 @@ Requires: ca-certificates-mozilla
Requires: python-certifi
Requires: python-cryptography >= 1.3.4
Requires: python-idna >= 2.0.0
Requires: python-pyOpenSSL
Requires: python-pyOpenSSL >= 0.14
Requires: python-six >= 1.12.0
Recommends: python-PySocks >= 1.5.6
Recommends: python-brotlipy >= 0.6.0
BuildArch: noarch
# for SSL module on older distros
%if 0%{?suse_version} < 1500
BuildRequires: %{oldpython}
%endif
%if %{with test}
BuildRequires: %{python_module PySocks}
BuildRequires: %{python_module PySocks >= 1.5.6}
BuildRequires: %{python_module brotlipy >= 0.6.0}
BuildRequires: %{python_module certifi}
BuildRequires: %{python_module cryptography >= 1.3.4}
BuildRequires: %{python_module dateutil}
BuildRequires: %{python_module flaky}
BuildRequires: %{python_module idna >= 2.0.0}
BuildRequires: %{python_module mock >= 1.3.0}
BuildRequires: %{python_module psutil}
BuildRequires: %{python_module pytest-freezegun}
BuildRequires: %{python_module pytest-timeout}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module six >= 1.12.0}
BuildRequires: %{python_module tornado < 6}
BuildRequires: %{python_module python-dateutil}
BuildRequires: %{python_module tornado >= 6}
BuildRequires: %{python_module trustme >= 0.5.3}
BuildRequires: %{python_module urllib3 >= %{version}}
%endif
Recommends: python-PySocks >= 1.5.6
Recommends: python-brotlipy >= 0.6.0
%python_subpackages
%description
@ -88,7 +90,8 @@ Highlights
Requests which is also powered by urllib3.
%prep
%setup -q -n urllib3-%{version}
%autosetup -p1 -n urllib3-%{version}
find . -type f -exec chmod a-x '{}' \;
find . -name __pycache__ -type d -exec rm -fr {} +
@ -128,18 +131,13 @@ ln -sf %{python3_sitelib}/__pycache__/six.cpython-%{python3_version_nodots}.pyc
%if %{with test}
%check
skiplist='not test_select_interrupt_exception and not test_selector_error and not timeout and not test_request_host_header_ignores_fqdn_dot and not test_dotted_fqdn and not TestImportWithoutSSL and not test_ssl_failed_fingerprint_verification'
case $(uname -m) in
ppc*)
skiplist="$skiplist and not test_select_timing and not test_select_multiple_interrupts_with_event and not test_interrupt_wait_for_read_with_event and not test_select_interrupt_with_event";;
esac
# the certificate validation is much stricter in new openssl so skip
# tests which would not validate it
skiplist="$skiplist and not test_client_no_intermediate"
export PYTHONDONTWRITEBYTECODE=1
export LANG="en_US.UTF8"
%pytest -k "${skiplist}"
# still broken with new ssl
skiplist='test_import_urllib3'
# skip some randomly failing tests (mostly on i586, but sometimes they fail on other architectures)
skiplist="$skiplist or test_ssl_read_timeout or test_ssl_failed_fingerprint_verification or test_ssl_custom_validation_failure_terminates"
# gh#urllib3/urllib3#2109
skiplist="$skiplist or test_timeout_errors_cause_retries"
%pytest -k "not (${skiplist})"
%endif
%if ! %{with test}

228
remove_mock.patch Normal file
View File

@ -0,0 +1,228 @@
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -14,7 +14,10 @@ sys.path.insert(0, root_path)
# Mock some expensive/platform-specific modules so build will work.
# (https://read-the-docs.readthedocs.io/en/latest/faq.html#\
# i-get-import-errors-on-libraries-that-depend-on-c-modules)
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
class MockModule(mock.Mock):
@@ -77,7 +80,7 @@ html_logo = "images/banner.svg"
html_theme_options = {
"announcement": """
- <a style=\"text-decoration: none; color: white;\"
+ <a style=\"text-decoration: none; color: white;\"
href=\"https://opencollective.com/urllib3\">
<img src=\"/en/latest/_static/favicon.png\"/> Sponsor urllib3 v2.0 on Open Collective
</a>
--- a/test/appengine/test_urlfetch.py
+++ b/test/appengine/test_urlfetch.py
@@ -5,7 +5,10 @@ Engine-patched version of httplib to mak
import httplib
import pytest
import StringIO
-from mock import patch
+try:
+ from unittest.mock import patch
+except ImportError:
+ from mock import patch
from ..test_no_ssl import TestWithoutSSL
--- a/test/contrib/test_pyopenssl.py
+++ b/test/contrib/test_pyopenssl.py
@@ -1,7 +1,10 @@
# -*- coding: utf-8 -*-
import os
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
import pytest
try:
--- a/test/contrib/test_pyopenssl_dependencies.py
+++ b/test/contrib/test_pyopenssl_dependencies.py
@@ -1,6 +1,9 @@
# -*- coding: utf-8 -*-
import pytest
-from mock import Mock, patch
+try:
+ from unittest.mock import Mock, patch
+except ImportError:
+ from mock import Mock, patch
try:
from urllib3.contrib.pyopenssl import extract_from_urllib3, inject_into_urllib3
--- a/test/test_connection.py
+++ b/test/test_connection.py
@@ -1,6 +1,9 @@
import datetime
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
import pytest
from urllib3.connection import RECENT_DATE, CertificateError, _match_hostname
--- a/test/test_connectionpool.py
+++ b/test/test_connectionpool.py
@@ -6,7 +6,10 @@ from ssl import SSLError as BaseSSLError
from test import SHORT_TIMEOUT
import pytest
-from mock import Mock
+try:
+ from unittest.mock import Mock
+except ImportError:
+ from mock import Mock
from dummyserver.server import DEFAULT_CA
from urllib3._collections import HTTPHeaderDict
--- a/test/test_queue_monkeypatch.py
+++ b/test/test_queue_monkeypatch.py
@@ -1,6 +1,9 @@
from __future__ import absolute_import
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
import pytest
from urllib3 import HTTPConnectionPool
--- a/test/test_response.py
+++ b/test/test_response.py
@@ -9,7 +9,10 @@ from base64 import b64decode
from io import BufferedReader, BytesIO, TextIOWrapper
from test import onlyBrotlipy
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
import pytest
import six
--- a/test/test_retry.py
+++ b/test/test_retry.py
@@ -1,6 +1,9 @@
import warnings
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
import pytest
from urllib3.exceptions import (
--- a/test/test_retry_deprecated.py
+++ b/test/test_retry_deprecated.py
@@ -1,7 +1,10 @@
# This is a copy-paste of test_retry.py with extra asserts about deprecated options. It will be removed for v2.
import warnings
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
import pytest
from urllib3.exceptions import (
--- a/test/test_ssl.py
+++ b/test/test_ssl.py
@@ -1,6 +1,9 @@
from test import notPyPy2
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
import pytest
from urllib3.exceptions import SNIMissingWarning
--- a/test/test_ssltransport.py
+++ b/test/test_ssltransport.py
@@ -4,7 +4,10 @@ import socket
import ssl
import sys
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
import pytest
from dummyserver.server import DEFAULT_CA, DEFAULT_CERTS
--- a/test/test_util.py
+++ b/test/test_util.py
@@ -9,7 +9,10 @@ from itertools import chain
from test import notBrotlipy, onlyBrotlipy, onlyPy2, onlyPy3
import pytest
-from mock import Mock, patch
+try:
+ from unittest.mock import Mock, patch
+except ImportError:
+ from mock import Mock, patch
from urllib3 import add_stderr_logger, disable_warnings, util
from urllib3.exceptions import (
--- a/test/with_dummyserver/test_connectionpool.py
+++ b/test/with_dummyserver/test_connectionpool.py
@@ -10,7 +10,10 @@ import warnings
from test import LONG_TIMEOUT, SHORT_TIMEOUT, onlyPy2
from threading import Event
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
import pytest
import six
--- a/test/with_dummyserver/test_https.py
+++ b/test/with_dummyserver/test_https.py
@@ -19,7 +19,10 @@ from test import (
resolvesLocalhostFQDN,
)
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
import pytest
import trustme
--- a/test/with_dummyserver/test_socketlevel.py
+++ b/test/with_dummyserver/test_socketlevel.py
@@ -52,7 +52,10 @@ from test import (
)
from threading import Event
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
import pytest
import trustme

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:91056c15fa70756691db97756772bb1eb9678fa585d9184f24534b100dc60f4a
size 256875

3
urllib3-1.26.2.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:19188f96923873c92ccb987120ec4acaa12f0461fa9ce5d3d0772bc965a39e08
size 286877