Accepting request 855669 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/855669
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-requests-toolbelt?expand=0&rev=5
This commit is contained in:
Dominique Leuenberger 2020-12-16 09:59:45 +00:00 committed by Git OBS Bridge
commit 564f1a8776
3 changed files with 237 additions and 5 deletions

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Mon Dec 14 00:35:01 UTC 2020 - Benjamin Greiner <code@bnavigator.de>
- Fix condition around BuildRequirement
-------------------------------------------------------------------
Sun Dec 13 21:51:50 UTC 2020 - Matej Cepl <mcepl@suse.com>
- We don't need to break Python 2.7
-------------------------------------------------------------------
Mon Dec 7 08:09:35 UTC 2020 - Matej Cepl <mcepl@suse.com>
- Add remove_mock.patch to remove dependency on the external mock
-------------------------------------------------------------------
Mon May 6 14:06:37 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-requests-toolbelt
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -26,6 +26,9 @@ Group: Development/Languages/Python
URL: https://github.com/requests/toolbelt
Source: https://files.pythonhosted.org/packages/source/r/requests-toolbelt/requests-toolbelt-%{version}.tar.gz
Patch0: fix-tests.patch
# PATCH-FIX-UPSTREAM remove_mock.patch bsc#[0-9]+ mcepl@suse.com
# remove dependency on the external mock package
Patch1: remove_mock.patch
BuildRequires: %{python_module requests >= 2.12.2}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
@ -34,9 +37,12 @@ Requires: python-requests >= 2.12.2
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module betamax >= 0.5.0}
BuildRequires: %{python_module mock}
BuildRequires: %{python_module pyOpenSSL}
# gh#pyca/cryptography#5606
BuildRequires: %{python_module pyOpenSSL >= 19.1.0}
BuildRequires: %{python_module pytest}
%if 0%{suse_version} <= 1500
BuildRequires: python-mock
%endif
# /SECTION
%python_subpackages
@ -47,8 +53,8 @@ really belong in ``requests`` proper. The minimum tested requests version is
some idiosyncracies prevent effective or sane testing on that version.
%prep
%setup -q -n requests-toolbelt-%{version}
%patch0 -p1
%autosetup -p1 -n requests-toolbelt-%{version}
rm -rf requests_toolbelt.egg-info
# requires network access
rm -v tests/test_multipart_encoder.py

211
remove_mock.patch Normal file
View File

@ -0,0 +1,211 @@
---
dev-requirements.txt | 1 -
tests/test_appengine_adapter.py | 2 +-
tests/test_auth.py | 2 +-
tests/test_downloadutils.py | 2 +-
tests/test_dump.py | 2 +-
tests/test_multipart_decoder.py | 2 +-
tests/test_proxy_digest_auth.py | 2 +-
tests/test_socket_options_adapter.py | 2 +-
tests/test_ssladapter.py | 2 +-
tests/threaded/test_api.py | 2 +-
tests/threaded/test_pool.py | 2 +-
tests/threaded/test_thread.py | 2 +-
tox.ini | 1 -
13 files changed, 11 insertions(+), 13 deletions(-)
--- a/tests/test_appengine_adapter.py
+++ b/tests/test_appengine_adapter.py
@@ -2,7 +2,10 @@
"""Tests for the AppEngineAdapter."""
import sys
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
import pytest
import requests
--- a/tests/test_auth.py
+++ b/tests/test_auth.py
@@ -1,7 +1,10 @@
# -*- coding: utf-8 -*-
import requests
import unittest
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
from requests_toolbelt.auth.guess import GuessAuth, GuessProxyAuth
from . import get_betamax
--- a/tests/test_downloadutils.py
+++ b/tests/test_downloadutils.py
@@ -8,7 +8,10 @@ import tempfile
import requests
from requests_toolbelt.downloadutils import stream
from requests_toolbelt.downloadutils import tee
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
import pytest
from . import get_betamax
--- a/tests/test_dump.py
+++ b/tests/test_dump.py
@@ -12,7 +12,10 @@ very complex and high-level.
from requests_toolbelt._compat import HTTPHeaderDict
from requests_toolbelt.utils import dump
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
import pytest
import requests
--- a/tests/test_multipart_decoder.py
+++ b/tests/test_multipart_decoder.py
@@ -2,7 +2,10 @@
import io
import sys
import unittest
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
import pytest
import requests
from requests_toolbelt.multipart.decoder import BodyPart
--- a/tests/test_proxy_digest_auth.py
+++ b/tests/test_proxy_digest_auth.py
@@ -2,7 +2,10 @@
"""Test proxy digest authentication."""
import unittest
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
import requests
from requests_toolbelt.auth import http_proxy_digest
--- a/tests/test_socket_options_adapter.py
+++ b/tests/test_socket_options_adapter.py
@@ -3,7 +3,10 @@
import contextlib
import socket
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
import requests
from requests_toolbelt._compat import poolmanager
--- a/tests/test_ssladapter.py
+++ b/tests/test_ssladapter.py
@@ -1,5 +1,8 @@
# -*- coding: utf-8 -*-
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
import pytest
import requests
import unittest
--- a/tests/threaded/test_api.py
+++ b/tests/threaded/test_api.py
@@ -1,6 +1,9 @@
"""Module containing tests for requests_toolbelt.threaded API."""
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
import pytest
from requests_toolbelt._compat import queue
--- a/tests/threaded/test_pool.py
+++ b/tests/threaded/test_pool.py
@@ -5,7 +5,10 @@ except ImportError:
import Queue as queue
import unittest
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
import pytest
from requests_toolbelt.threaded import pool
--- a/tests/threaded/test_thread.py
+++ b/tests/threaded/test_thread.py
@@ -7,7 +7,10 @@ import threading
import unittest
import uuid
-import mock
+try:
+ import unittest.mock as mock
+except ImportError:
+ import mock
import requests.exceptions
from requests_toolbelt.threaded import thread
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -1,4 +1,3 @@
pytest
-mock
pyopenssl
git+git://github.com/sigmavirus24/betamax
--- a/tox.ini
+++ b/tox.ini
@@ -6,7 +6,6 @@ pip_pre = False
deps =
requests{env:REQUESTS_VERSION:>=2.0.1,<3.0.0}
pytest
- mock
pyopenssl
ndg-httpsclient
betamax>0.5.0
--- a/tests/test_source_adapter.py
+++ b/tests/test_source_adapter.py
@@ -1,6 +1,9 @@
# -*- coding: utf-8 -*-
from requests.adapters import DEFAULT_POOLSIZE, DEFAULT_POOLBLOCK
-from mock import patch
+try:
+ from unittest.mock import patch
+except ImportError:
+ from mock import patch
from requests_toolbelt.adapters.source import SourceAddressAdapter
import pytest
--- a/tests/test_user_agent.py
+++ b/tests/test_user_agent.py
@@ -2,7 +2,10 @@
import unittest
import sys
-from mock import patch
+try:
+ from unittest.mock import patch
+except ImportError:
+ from mock import patch
import pytest
from requests_toolbelt.utils import user_agent as ua