diff --git a/python-PyBrowserID-unittest-mock.patch b/python-PyBrowserID-unittest-mock.patch new file mode 100644 index 0000000..cdb3b79 --- /dev/null +++ b/python-PyBrowserID-unittest-mock.patch @@ -0,0 +1,34 @@ +Index: PyBrowserID-0.14.0/browserid/tests/test_supportdoc.py +=================================================================== +--- PyBrowserID-0.14.0.orig/browserid/tests/test_supportdoc.py 2014-12-12 06:15:36.000000000 +0100 ++++ PyBrowserID-0.14.0/browserid/tests/test_supportdoc.py 2021-05-27 11:15:09.807769893 +0200 +@@ -1,7 +1,11 @@ + import json + import socket + +-from mock import Mock, patch ++try: ++ from unittest.mock import Mock, patch ++except ImportError: ++ from mock import Mock, patch ++ + from requests.exceptions import RequestException + + from browserid.supportdoc import fetch_support_document, SupportDocumentManager +Index: PyBrowserID-0.14.0/browserid/tests/test_verifiers.py +=================================================================== +--- PyBrowserID-0.14.0.orig/browserid/tests/test_verifiers.py 2018-01-11 22:01:14.000000000 +0100 ++++ PyBrowserID-0.14.0/browserid/tests/test_verifiers.py 2021-05-27 11:15:59.064034201 +0200 +@@ -5,7 +5,11 @@ + import time + import warnings + +-from mock import Mock, patch ++try: ++ from unittest.mock import Mock, patch ++except ImportError: ++ from mock import Mock, patch ++ + + import browserid + from browserid.tests.support import (patched_supportdoc_fetching, diff --git a/python-PyBrowserID.changes b/python-PyBrowserID.changes index ca56aca..8322002 100644 --- a/python-PyBrowserID.changes +++ b/python-PyBrowserID.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu May 27 08:31:12 UTC 2021 - pgajdos@suse.com + +- %check: use %pyunittest rpm macro +- Add python-PyBrowserID-unittest-mock.patch removes dependency + on mock package (gh#mozilla/PyBrowserID#42). + ------------------------------------------------------------------- Thu Nov 7 15:14:07 UTC 2019 - Matej Cepl diff --git a/python-PyBrowserID.spec b/python-PyBrowserID.spec index ceda230..df551a9 100644 --- a/python-PyBrowserID.spec +++ b/python-PyBrowserID.spec @@ -1,7 +1,7 @@ # # spec file for package python-PyBrowserID # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2021 SUSE LLC # Copyright (c) 2017-2018 The openSUSE Project. # # All modifications and additions to the file contributed by third parties @@ -18,7 +18,6 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} -%bcond_without test Name: python-PyBrowserID Version: 0.14.0 Release: 0 @@ -26,15 +25,19 @@ Summary: Python library for the BrowserID Protocol License: MPL-2.0 URL: https://github.com/mozilla/PyBrowserID Source: https://files.pythonhosted.org/packages/source/P/PyBrowserID/PyBrowserID-%{version}.tar.gz +# https://github.com/mozilla/PyBrowserID/issues/42 +Patch0: python-PyBrowserID-unittest-mock.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-requests BuildArch: noarch -%if %{with test} +# SECTION test requirements +%if %{suse_version} < 1550 BuildRequires: %{python_module mock} -BuildRequires: %{python_module requests} %endif +BuildRequires: %{python_module requests} +# /SECTION %python_subpackages %description @@ -43,6 +46,7 @@ Mozilla Persona. %prep %setup -q -n PyBrowserID-%{version} +%patch0 -p1 %build %python_build @@ -51,10 +55,8 @@ Mozilla Persona. %python_install %python_expand %fdupes %{buildroot}%{$python_sitelib} -%if %{with test} %check -%python_exec setup.py test -%endif +%pyunittest discover -v %files %{python_files} %doc CHANGES.txt README.rst