1
0
forked from pool/python-psutil

Accepting request 867673 from home:alarrosa:branches:devel:languages:python

- Do not install tests (and change the way they're run since they
  were run from %{buildroot})

- Add patch to skip tests related to rlimit and zombie processes
  that fail when building for python2 on i586:
  * skip_rlimit_tests_on_python2.patch

OBS-URL: https://build.opensuse.org/request/show/867673
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-psutil?expand=0&rev=130
This commit is contained in:
Matej Cepl 2021-01-29 09:54:20 +00:00 committed by Git OBS Bridge
parent 3950a787af
commit be1bd93299
3 changed files with 70 additions and 1 deletions

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Fri Jan 29 08:19:00 UTC 2021 - Antonio Larrosa <alarrosa@suse.com>
- Do not install tests (and change the way they're run since they
were run from %{buildroot})
-------------------------------------------------------------------
Thu Jan 28 16:25:35 UTC 2021 - Antonio Larrosa <alarrosa@suse.com>
- Add patch to skip tests related to rlimit and zombie processes
that fail when building for python2 on i586:
* skip_rlimit_tests_on_python2.patch
-------------------------------------------------------------------
Mon Jan 25 16:03:37 UTC 2021 - Antonio Larrosa <alarrosa@suse.com>

View File

@ -34,6 +34,8 @@ Patch1: skip-obs.patch
# PATCH-FIX-UPSTREAM skip_failing_tests.patch gh#giampaolo/psutil#1635 mcepl@suse.com
# skip tests failing because of incomplete emulation of the environment in osc build
Patch2: skip_failing_tests.patch
# PATCH-FIX-SLE skip_rlimit_tests_on_python2.patch alarrosa@suse.com
Patch3: skip_rlimit_tests_on_python2.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
@ -75,6 +77,7 @@ sed -i "1s/#!.*//" psutil/{__init__.py,_compat.py,_psbsd.py,_pslinux.py,_psosx.p
%{python_expand mkdir -p %{buildroot}%{_docdir}/%{$python_prefix}-psutil
cp -r scripts %{buildroot}%{_docdir}/%{$python_prefix}-psutil/
find %{buildroot}%{_docdir}/%{$python_prefix}-psutil/scripts/ -type f -name "*.py" -exec sed -i "s|#!%{_bindir}/env python.*|#!%{__$python}|" {} \;
rm -rf %{buildroot}%{$python_sitearch}/psutil/tests
%fdupes %{buildroot}%{_docdir}/%{$python_prefix}-psutil/
%fdupes %{buildroot}%{$python_sitearch}
}
@ -84,9 +87,10 @@ find %{buildroot}%{_docdir}/%{$python_prefix}-psutil/scripts/ -type f -name "*.p
export LANG=en_US.UTF-8
export PSUTIL_TESTING=1
export TRAVIS=1
march=`python3 -c "import platform ; print(platform.machine())"`
# Note test_fetch_all is a bit flaky, occasionally failing
%python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} $python -Wa psutil/tests/runner.py
%python_expand PYTHONPATH=build/lib.linux-${march}-%{$python_version}/ $python -Wa psutil/tests/runner.py
%endif
%files %{python_files}

View File

@ -0,0 +1,52 @@
Index: psutil-5.8.0/psutil/tests/test_process.py
===================================================================
--- psutil-5.8.0.orig/psutil/tests/test_process.py
+++ psutil-5.8.0/psutil/tests/test_process.py
@@ -416,6 +416,7 @@ class TestProcess(PsutilTestCase):
p.ionice(init)
@unittest.skipIf(not HAS_RLIMIT, "not supported")
+ @unittest.skipIf(sys.version_info.major == 2, "not supported on python2")
def test_rlimit_get(self):
import resource
p = psutil.Process(os.getpid())
@@ -439,6 +440,7 @@ class TestProcess(PsutilTestCase):
self.assertGreaterEqual(ret[1], -1)
@unittest.skipIf(not HAS_RLIMIT, "not supported")
+ @unittest.skipIf(sys.version_info.major == 2, "not supported on python2")
def test_rlimit_set(self):
p = self.spawn_psproc()
p.rlimit(psutil.RLIMIT_NOFILE, (5, 5))
@@ -452,6 +454,7 @@ class TestProcess(PsutilTestCase):
p.rlimit(psutil.RLIMIT_NOFILE, (5, 5, 5))
@unittest.skipIf(not HAS_RLIMIT, "not supported")
+ @unittest.skipIf(sys.version_info.major == 2, "not supported on python2")
def test_rlimit(self):
p = psutil.Process()
testfn = self.get_testfn()
@@ -472,6 +475,7 @@ class TestProcess(PsutilTestCase):
self.assertEqual(p.rlimit(psutil.RLIMIT_FSIZE), (soft, hard))
@unittest.skipIf(not HAS_RLIMIT, "not supported")
+ @unittest.skipIf(sys.version_info.major == 2, "not supported on python2")
def test_rlimit_infinity(self):
# First set a limit, then re-set it by specifying INFINITY
# and assume we overridden the previous limit.
@@ -487,6 +491,7 @@ class TestProcess(PsutilTestCase):
self.assertEqual(p.rlimit(psutil.RLIMIT_FSIZE), (soft, hard))
@unittest.skipIf(not HAS_RLIMIT, "not supported")
+ @unittest.skipIf(sys.version_info.major == 2, "not supported on python2")
def test_rlimit_infinity_value(self):
# RLIMIT_FSIZE should be RLIM_INFINITY, which will be a really
# big number on a platform with large file support. On these
@@ -1270,6 +1275,7 @@ class TestProcess(PsutilTestCase):
self.assertEqual(normcase(p.exe()), normcase(PYTHON_EXE))
@unittest.skipIf(not POSIX, 'POSIX only')
+ @unittest.skipIf(sys.version_info.major == 2, "not supported on python2")
def test_zombie_process(self):
def succeed_or_zombie_p_exc(fun):
try: