From 545fa25a7d7eeaa42fbeb66d7eaa6c11b388cc5a60f1da95dcd5066b804ec740 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Thu, 27 May 2021 09:48:35 +0000 Subject: [PATCH 1/2] Accepting request 895714 from home:pgajdos:python setup.py test replacement OBS-URL: https://build.opensuse.org/request/show/895714 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-PyBrowserID?expand=0&rev=8 --- python-PyBrowserID-unittest-mock.patch | 34 ++++++++++++++++++++++++++ python-PyBrowserID.changes | 5 ++++ python-PyBrowserID.spec | 16 ++++++------ 3 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 python-PyBrowserID-unittest-mock.patch 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..64d0039 100644 --- a/python-PyBrowserID.changes +++ b/python-PyBrowserID.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu May 27 08:31:12 UTC 2021 - pgajdos@suse.com + +- %check: use %pyunittest rpm macro + ------------------------------------------------------------------- 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 From 8c693f4a51296d184d9a34ae6b054a4c63437ec08c7d567ec41ea9f71683d33c Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Thu, 27 May 2021 12:19:36 +0000 Subject: [PATCH 2/2] - Add python-PyBrowserID-unittest-mock.patch removes dependency on mock package (gh#mozilla/PyBrowserID#42). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-PyBrowserID?expand=0&rev=9 --- python-PyBrowserID.changes | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python-PyBrowserID.changes b/python-PyBrowserID.changes index 64d0039..8322002 100644 --- a/python-PyBrowserID.changes +++ b/python-PyBrowserID.changes @@ -2,6 +2,8 @@ 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