Use mock from the standard library
Since Python 3.3, mock is part of unittest in the standard library. Drop the build dependency on the deprecated python-mock package https://fedoraproject.org/wiki/Changes/DeprecatePythonMock
This commit is contained in:
parent
7762d7cb30
commit
7af7a85478
73
python-httplib2.nomock.patch
Normal file
73
python-httplib2.nomock.patch
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
diff --git a/requirements-test.txt b/requirements-test.txt
|
||||||
|
index d208a8f..623875e 100644
|
||||||
|
--- a/requirements-test.txt
|
||||||
|
+++ b/requirements-test.txt
|
||||||
|
@@ -1,6 +1,6 @@
|
||||||
|
flake8==3.4.1
|
||||||
|
future==0.16.0
|
||||||
|
-mock==2.0.0
|
||||||
|
+mock==2.0.0;python_version<"3.3"
|
||||||
|
pytest-cov==2.5.1
|
||||||
|
pytest-forked==0.2
|
||||||
|
pytest-randomly==1.2.1
|
||||||
|
diff --git a/tests/test_cacerts_from_env.py b/tests/test_cacerts_from_env.py
|
||||||
|
index cb2bd9f..f04ba0e 100644
|
||||||
|
--- a/tests/test_cacerts_from_env.py
|
||||||
|
+++ b/tests/test_cacerts_from_env.py
|
||||||
|
@@ -1,6 +1,9 @@
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
-import mock
|
||||||
|
+try:
|
||||||
|
+ from unittest import mock
|
||||||
|
+except ImportError:
|
||||||
|
+ import mock
|
||||||
|
import pytest
|
||||||
|
import tempfile
|
||||||
|
import httplib2
|
||||||
|
diff --git a/tests/test_http.py b/tests/test_http.py
|
||||||
|
index f61992c..65bac01 100644
|
||||||
|
--- a/tests/test_http.py
|
||||||
|
+++ b/tests/test_http.py
|
||||||
|
@@ -5,7 +5,10 @@ from __future__ import print_function
|
||||||
|
import email.utils
|
||||||
|
import errno
|
||||||
|
import httplib2
|
||||||
|
-import mock
|
||||||
|
+try:
|
||||||
|
+ from unittest import mock
|
||||||
|
+except ImportError:
|
||||||
|
+ import mock
|
||||||
|
import os
|
||||||
|
import pytest
|
||||||
|
from six.moves import http_client, urllib
|
||||||
|
diff --git a/tests/test_other.py b/tests/test_other.py
|
||||||
|
index 0f450ab..6b902b9 100644
|
||||||
|
--- a/tests/test_other.py
|
||||||
|
+++ b/tests/test_other.py
|
||||||
|
@@ -1,5 +1,8 @@
|
||||||
|
import httplib2
|
||||||
|
-import mock
|
||||||
|
+try:
|
||||||
|
+ from unittest import mock
|
||||||
|
+except ImportError:
|
||||||
|
+ import mock
|
||||||
|
import os
|
||||||
|
import pickle
|
||||||
|
import pytest
|
||||||
|
diff --git a/tests/test_proxy.py b/tests/test_proxy.py
|
||||||
|
index edafe01..556b448 100644
|
||||||
|
--- a/tests/test_proxy.py
|
||||||
|
+++ b/tests/test_proxy.py
|
||||||
|
@@ -9,7 +9,10 @@ from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import httplib2
|
||||||
|
-import mock
|
||||||
|
+try:
|
||||||
|
+ from unittest import mock
|
||||||
|
+except ImportError:
|
||||||
|
+ import mock
|
||||||
|
import os
|
||||||
|
import pytest
|
||||||
|
import socket
|
@ -11,6 +11,10 @@ Source: https://github.com/httplib2/httplib2/archive/v%{version}/%{srcna
|
|||||||
# Patch to use the Fedora ca certs instead of the bundled ones
|
# Patch to use the Fedora ca certs instead of the bundled ones
|
||||||
#
|
#
|
||||||
Patch1: python-%{srcname}.certfile.patch
|
Patch1: python-%{srcname}.certfile.patch
|
||||||
|
#
|
||||||
|
# Patch to use mock from the standard library, upstream PR#185
|
||||||
|
#
|
||||||
|
Patch2: python-%{srcname}.nomock.patch
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
@ -30,7 +34,6 @@ BuildRequires: python3-pytest-forked
|
|||||||
BuildRequires: python3-pytest-flake8
|
BuildRequires: python3-pytest-flake8
|
||||||
BuildRequires: python3-pytest-timeout
|
BuildRequires: python3-pytest-timeout
|
||||||
BuildRequires: python3-six
|
BuildRequires: python3-six
|
||||||
BuildRequires: python3-mock
|
|
||||||
|
|
||||||
%description -n python3-%{srcname} %{_description}
|
%description -n python3-%{srcname} %{_description}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user