Run tests correctly
This commit is contained in:
parent
6dfa2898a6
commit
d20a0bc664
@ -12,17 +12,22 @@ PidFile can also be used as a context manager or a decorator.}
|
||||
|
||||
%if %{defined el6}
|
||||
%bcond_without python2
|
||||
# nose is too old
|
||||
%bcond_with python2_tests
|
||||
%endif
|
||||
|
||||
%if %{defined el7}
|
||||
%bcond_without python2
|
||||
%bcond_without python2_tests
|
||||
%endif
|
||||
|
||||
%if %{defined fedora} && 0%{?fedora} < 29
|
||||
%bcond_without python2
|
||||
%bcond_without python2_tests
|
||||
%endif
|
||||
|
||||
%bcond_without python3
|
||||
%bcond_without python3_tests
|
||||
|
||||
Name: python-%{srcname}
|
||||
Version: 2.2.3
|
||||
@ -33,6 +38,9 @@ License: ASL 2.0
|
||||
URL: https://github.com/trbs/pid
|
||||
Source0: %pypi_source
|
||||
|
||||
# https://github.com/trbs/pid/pull/23
|
||||
Patch0: use-standard-library-mock-when-available.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
%description %{common_description}
|
||||
@ -43,7 +51,10 @@ Summary: %{summary}
|
||||
|
||||
BuildRequires: python2-devel
|
||||
BuildRequires: python2-setuptools
|
||||
BuildRequires: python2-nose
|
||||
%if %{with python2_tests}
|
||||
BuildRequires: python2-nose >= 1.0
|
||||
BuildRequires: python2-mock
|
||||
%endif
|
||||
|
||||
%{?python_provide:%python_provide python2-%{srcname}}
|
||||
|
||||
@ -56,7 +67,9 @@ Summary: %{summary}
|
||||
|
||||
BuildRequires: python%{python3_pkgversion}-devel
|
||||
BuildRequires: python%{python3_pkgversion}-setuptools
|
||||
BuildRequires: python%{python3_pkgversion}-nose
|
||||
%if %{with python3_tests}
|
||||
BuildRequires: python%{python3_pkgversion}-nose >= 1.0
|
||||
%endif
|
||||
|
||||
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
|
||||
|
||||
@ -86,16 +99,11 @@ rm -rf %{srcname}.egg-info
|
||||
%endif
|
||||
|
||||
%check
|
||||
%if %{with python2}
|
||||
# Skip the test suite on EL6, nose is too old
|
||||
%if 0%{?rhel} <= 6
|
||||
%else
|
||||
%{__python2} setup.py test
|
||||
%if %{with python2_tests}
|
||||
PYTHONPATH=%{buildroot}%{python2_sitelib} nosetests-%{python2_version} --verbose
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%if %{with python3}
|
||||
%{__python3} setup.py test
|
||||
%if %{with python3_tests}
|
||||
PYTHONPATH=%{buildroot}%{python3_sitelib} nosetests-%{python3_version} --verbose
|
||||
%endif
|
||||
|
||||
%if %{with python2}
|
||||
@ -118,6 +126,7 @@ rm -rf %{srcname}.egg-info
|
||||
* Tue Mar 05 2019 Carl George <carl@george.computer> - 2.2.3-1
|
||||
- Latest upstream
|
||||
- Build python3 subpackage on el6
|
||||
- Run tests correctly
|
||||
|
||||
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.1-10
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
16
use-standard-library-mock-when-available.patch
Normal file
16
use-standard-library-mock-when-available.patch
Normal file
@ -0,0 +1,16 @@
|
||||
diff --git a/tests/test_pid.py b/tests/test_pid.py
|
||||
index 7c57c46..e36c29e 100644
|
||||
--- a/tests/test_pid.py
|
||||
+++ b/tests/test_pid.py
|
||||
@@ -2,7 +2,10 @@
|
||||
import os.path
|
||||
import signal
|
||||
from contextlib import contextmanager
|
||||
-from mock import patch
|
||||
+try:
|
||||
+ from unittest.mock import patch
|
||||
+except ImportError:
|
||||
+ from mock import patch
|
||||
|
||||
import pid
|
||||
|
Loading…
Reference in New Issue
Block a user