forked from pool/python-PyBrowserID
		
	Accepting request 895756 from devel:languages:python
- %check: use %pyunittest rpm macro - Add python-PyBrowserID-unittest-mock.patch removes dependency on mock package (gh#mozilla/PyBrowserID#42). OBS-URL: https://build.opensuse.org/request/show/895756 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-PyBrowserID?expand=0&rev=4
This commit is contained in:
		
							
								
								
									
										34
									
								
								python-PyBrowserID-unittest-mock.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								python-PyBrowserID-unittest-mock.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -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, | ||||||
| @@ -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 <mcepl@suse.com> | Thu Nov  7 15:14:07 UTC 2019 - Matej Cepl <mcepl@suse.com> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| # | # | ||||||
| # spec file for package python-PyBrowserID | # 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. | # Copyright (c) 2017-2018 The openSUSE Project. | ||||||
| # | # | ||||||
| # All modifications and additions to the file contributed by third parties | # All modifications and additions to the file contributed by third parties | ||||||
| @@ -18,7 +18,6 @@ | |||||||
|  |  | ||||||
|  |  | ||||||
| %{?!python_module:%define python_module() python-%{**} python3-%{**}} | %{?!python_module:%define python_module() python-%{**} python3-%{**}} | ||||||
| %bcond_without test |  | ||||||
| Name:           python-PyBrowserID | Name:           python-PyBrowserID | ||||||
| Version:        0.14.0 | Version:        0.14.0 | ||||||
| Release:        0 | Release:        0 | ||||||
| @@ -26,15 +25,19 @@ Summary:        Python library for the BrowserID Protocol | |||||||
| License:        MPL-2.0 | License:        MPL-2.0 | ||||||
| URL:            https://github.com/mozilla/PyBrowserID | URL:            https://github.com/mozilla/PyBrowserID | ||||||
| Source:         https://files.pythonhosted.org/packages/source/P/PyBrowserID/PyBrowserID-%{version}.tar.gz | 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:  %{python_module setuptools} | ||||||
| BuildRequires:  fdupes | BuildRequires:  fdupes | ||||||
| BuildRequires:  python-rpm-macros | BuildRequires:  python-rpm-macros | ||||||
| Requires:       python-requests | Requires:       python-requests | ||||||
| BuildArch:      noarch | BuildArch:      noarch | ||||||
| %if %{with test} | # SECTION test requirements | ||||||
|  | %if %{suse_version} < 1550 | ||||||
| BuildRequires:  %{python_module mock} | BuildRequires:  %{python_module mock} | ||||||
| BuildRequires:  %{python_module requests} |  | ||||||
| %endif | %endif | ||||||
|  | BuildRequires:  %{python_module requests} | ||||||
|  | # /SECTION | ||||||
| %python_subpackages | %python_subpackages | ||||||
|  |  | ||||||
| %description | %description | ||||||
| @@ -43,6 +46,7 @@ Mozilla Persona. | |||||||
|  |  | ||||||
| %prep | %prep | ||||||
| %setup -q -n PyBrowserID-%{version} | %setup -q -n PyBrowserID-%{version} | ||||||
|  | %patch0 -p1 | ||||||
|  |  | ||||||
| %build | %build | ||||||
| %python_build | %python_build | ||||||
| @@ -51,10 +55,8 @@ Mozilla Persona. | |||||||
| %python_install | %python_install | ||||||
| %python_expand %fdupes %{buildroot}%{$python_sitelib} | %python_expand %fdupes %{buildroot}%{$python_sitelib} | ||||||
|  |  | ||||||
| %if %{with test} |  | ||||||
| %check | %check | ||||||
| %python_exec setup.py test | %pyunittest discover -v | ||||||
| %endif |  | ||||||
|  |  | ||||||
| %files %{python_files} | %files %{python_files} | ||||||
| %doc CHANGES.txt README.rst | %doc CHANGES.txt README.rst | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user