forked from pool/python-psutil
Accepting request 989366 from home:bnavigator:branches:devel:languages:python
- Fix tests: setuptools changed the builddir library path and does not find the module from it. Use the installed platlib instead and exclude psutil.tests only later. - Refresh skip-obs.patch OBS-URL: https://build.opensuse.org/request/show/989366 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-psutil?expand=0&rev=144
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Jul 15 07:59:26 UTC 2022 - Ben Greiner <code@bnavigator.de>
|
||||||
|
|
||||||
|
- Fix tests: setuptools changed the builddir library path and does
|
||||||
|
not find the module from it. Use the installed platlib instead
|
||||||
|
and exclude psutil.tests only later.
|
||||||
|
- Refresh skip-obs.patch
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Jun 23 11:09:31 UTC 2022 - Dr. Werner Fink <werner@suse.de>
|
Thu Jun 23 11:09:31 UTC 2022 - Dr. Werner Fink <werner@suse.de>
|
||||||
|
|
||||||
|
@@ -78,7 +78,6 @@ sed -i "1s/#!.*//" psutil/{__init__.py,_compat.py,_psbsd.py,_pslinux.py,_psosx.p
|
|||||||
%{python_expand mkdir -p %{buildroot}%{_docdir}/%{$python_prefix}-psutil
|
%{python_expand mkdir -p %{buildroot}%{_docdir}/%{$python_prefix}-psutil
|
||||||
cp -r scripts %{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}|" {} \;
|
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}%{_docdir}/%{$python_prefix}-psutil/
|
||||||
%fdupes %{buildroot}%{$python_sitearch}
|
%fdupes %{buildroot}%{$python_sitearch}
|
||||||
}
|
}
|
||||||
@@ -87,13 +86,12 @@ rm -rf %{buildroot}%{$python_sitearch}/psutil/tests
|
|||||||
%check
|
%check
|
||||||
export LANG=en_US.UTF-8
|
export LANG=en_US.UTF-8
|
||||||
export PSUTIL_TESTING=1
|
export PSUTIL_TESTING=1
|
||||||
export TRAVIS=1
|
export PSUTIL_DEBUG=1
|
||||||
march=`python3 -c "import platform ; print(platform.machine())"`
|
export PYTHONDONTRWRITEBYTECODE=1
|
||||||
|
mkdir testd
|
||||||
# Note test_fetch_all is a bit flaky, occasionally failing
|
pushd testd
|
||||||
%{python_expand export PYTHONPATH=build/lib.linux-${march}-%{$python_version}/
|
%python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} $python -Wa -m psutil.tests
|
||||||
$python -Wa psutil/tests/runner.py
|
popd
|
||||||
}
|
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%files %{python_files}
|
%files %{python_files}
|
||||||
@@ -101,7 +99,7 @@ $python -Wa psutil/tests/runner.py
|
|||||||
%doc CREDITS HISTORY.rst README.rst
|
%doc CREDITS HISTORY.rst README.rst
|
||||||
%{_docdir}/%{python_prefix}-psutil/scripts/
|
%{_docdir}/%{python_prefix}-psutil/scripts/
|
||||||
%{python_sitearch}/psutil/
|
%{python_sitearch}/psutil/
|
||||||
%{python_sitearch}/psutil/_psutil_*.so
|
%exclude %{python_sitearch}/psutil/tests
|
||||||
%{python_sitearch}/psutil-%{version}-py*.egg-info
|
%{python_sitearch}/psutil-%{version}*-info
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
120
skip-obs.patch
120
skip-obs.patch
@@ -1,128 +1,136 @@
|
|||||||
Index: psutil-5.9.0/psutil/tests/test_misc.py
|
Index: psutil-5.9.1/psutil/tests/test_misc.py
|
||||||
===================================================================
|
===================================================================
|
||||||
--- psutil-5.9.0.orig/psutil/tests/test_misc.py
|
--- psutil-5.9.1.orig/psutil/tests/test_misc.py
|
||||||
+++ psutil-5.9.0/psutil/tests/test_misc.py
|
+++ psutil-5.9.1/psutil/tests/test_misc.py
|
||||||
@@ -368,6 +368,7 @@ class TestMisc(PsutilTestCase):
|
@@ -252,6 +252,7 @@ class TestMisc(PsutilTestCase):
|
||||||
|
|
||||||
# XXX: https://github.com/pypa/setuptools/pull/2896
|
# XXX: https://github.com/pypa/setuptools/pull/2896
|
||||||
@unittest.skipIf(APPVEYOR, "temporarily disabled due to setuptools bug")
|
@unittest.skipIf(APPVEYOR, "temporarily disabled due to setuptools bug")
|
||||||
+ @unittest.skipIf(True, 'does not work on obs')
|
+ @unittest.skip("Fails in OBS")
|
||||||
def test_setup_script(self):
|
def test_setup_script(self):
|
||||||
setup_py = os.path.join(ROOT_DIR, 'setup.py')
|
setup_py = os.path.join(ROOT_DIR, 'setup.py')
|
||||||
if CI_TESTING and not os.path.exists(setup_py):
|
if CI_TESTING and not os.path.exists(setup_py):
|
||||||
@@ -710,7 +711,7 @@ class TestScripts(PsutilTestCase):
|
@@ -745,6 +746,7 @@ class TestScripts(PsutilTestCase):
|
||||||
src = f.read()
|
src = f.read()
|
||||||
ast.parse(src)
|
ast.parse(src)
|
||||||
|
|
||||||
- def test_coverage(self):
|
+ @unittest.skip("Fails in OBS")
|
||||||
+ def _test_coverage(self):
|
def test_coverage(self):
|
||||||
# make sure all example scripts have a test method defined
|
# make sure all example scripts have a test method defined
|
||||||
meths = dir(self)
|
meths = dir(self)
|
||||||
for name in os.listdir(SCRIPTS_DIR):
|
@@ -764,6 +766,7 @@ class TestScripts(PsutilTestCase):
|
||||||
@@ -729,7 +730,7 @@ class TestScripts(PsutilTestCase):
|
|
||||||
if not stat.S_IXUSR & os.stat(path)[stat.ST_MODE]:
|
if not stat.S_IXUSR & os.stat(path)[stat.ST_MODE]:
|
||||||
raise self.fail('%r is not executable' % path)
|
raise self.fail('%r is not executable' % path)
|
||||||
|
|
||||||
- def test_disk_usage(self):
|
+ @unittest.skip("Fails in OBS")
|
||||||
+ def _test_disk_usage(self):
|
def test_disk_usage(self):
|
||||||
self.assert_stdout('disk_usage.py')
|
self.assert_stdout('disk_usage.py')
|
||||||
|
|
||||||
def test_free(self):
|
Index: psutil-5.9.1/psutil/tests/test_linux.py
|
||||||
Index: psutil-5.9.0/psutil/tests/test_linux.py
|
|
||||||
===================================================================
|
===================================================================
|
||||||
--- psutil-5.9.0.orig/psutil/tests/test_linux.py
|
--- psutil-5.9.1.orig/psutil/tests/test_linux.py
|
||||||
+++ psutil-5.9.0/psutil/tests/test_linux.py
|
+++ psutil-5.9.1/psutil/tests/test_linux.py
|
||||||
@@ -683,7 +683,7 @@ class TestSystemCPUCountLogical(PsutilTe
|
@@ -688,6 +688,7 @@ class TestSystemCPUCountLogical(PsutilTe
|
||||||
self.assertEqual(psutil.cpu_count(logical=True), num)
|
self.assertEqual(psutil.cpu_count(logical=True), num)
|
||||||
|
|
||||||
@unittest.skipIf(not which("lscpu"), "lscpu utility not available")
|
@unittest.skipIf(not which("lscpu"), "lscpu utility not available")
|
||||||
- def test_against_lscpu(self):
|
+ @unittest.skip("Fails in OBS")
|
||||||
+ def _test_against_lscpu(self):
|
def test_against_lscpu(self):
|
||||||
out = sh("lscpu -p")
|
out = sh("lscpu -p")
|
||||||
num = len([x for x in out.split('\n') if not x.startswith('#')])
|
num = len([x for x in out.split('\n') if not x.startswith('#')])
|
||||||
self.assertEqual(psutil.cpu_count(logical=True), num)
|
@@ -731,6 +732,7 @@ class TestSystemCPUCountLogical(PsutilTe
|
||||||
@@ -726,7 +726,7 @@ class TestSystemCPUCountLogical(PsutilTe
|
|
||||||
class TestSystemCPUCountCores(PsutilTestCase):
|
class TestSystemCPUCountCores(PsutilTestCase):
|
||||||
|
|
||||||
@unittest.skipIf(not which("lscpu"), "lscpu utility not available")
|
@unittest.skipIf(not which("lscpu"), "lscpu utility not available")
|
||||||
- def test_against_lscpu(self):
|
+ @unittest.skip("Fails in OBS")
|
||||||
+ def _test_against_lscpu(self):
|
def test_against_lscpu(self):
|
||||||
out = sh("lscpu -p")
|
out = sh("lscpu -p")
|
||||||
core_ids = set()
|
core_ids = set()
|
||||||
for line in out.split('\n'):
|
@@ -1077,6 +1079,7 @@ class TestSystemDiskPartitions(PsutilTes
|
||||||
@@ -1072,7 +1072,7 @@ class TestSystemDiskPartitions(PsutilTes
|
|
||||||
|
|
||||||
@unittest.skipIf(not hasattr(os, 'statvfs'), "os.statvfs() not available")
|
@unittest.skipIf(not hasattr(os, 'statvfs'), "os.statvfs() not available")
|
||||||
@skip_on_not_implemented()
|
@skip_on_not_implemented()
|
||||||
- def test_against_df(self):
|
+ @unittest.skip("Fails in OBS")
|
||||||
+ def _test_against_df(self):
|
def test_against_df(self):
|
||||||
# test psutil.disk_usage() and psutil.disk_partitions()
|
# test psutil.disk_usage() and psutil.disk_partitions()
|
||||||
# against "df -a"
|
# against "df -a"
|
||||||
def df(path):
|
@@ -1251,6 +1254,7 @@ class TestSystemDiskIoCounters(PsutilTes
|
||||||
@@ -1246,7 +1246,7 @@ class TestSystemDiskIoCounters(PsutilTes
|
|
||||||
self.assertEqual(ret.read_count, 1)
|
self.assertEqual(ret.read_count, 1)
|
||||||
self.assertEqual(ret.write_count, 5)
|
self.assertEqual(ret.write_count, 5)
|
||||||
|
|
||||||
- def test_emulate_use_sysfs(self):
|
+ @unittest.skip("Fails in OBS")
|
||||||
+ def _test_emulate_use_sysfs(self):
|
def test_emulate_use_sysfs(self):
|
||||||
def exists(path):
|
def exists(path):
|
||||||
if path == '/proc/diskstats':
|
if path == '/proc/diskstats':
|
||||||
return False
|
@@ -1294,6 +1298,7 @@ class TestRootFsDeviceFinder(PsutilTestC
|
||||||
Index: psutil-5.9.0/psutil/tests/test_posix.py
|
finder.ask_sys_class_block()
|
||||||
|
|
||||||
|
@unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
|
||||||
|
+ @unittest.skip("Fails in OBS")
|
||||||
|
def test_comparisons(self):
|
||||||
|
finder = RootFsDeviceFinder()
|
||||||
|
self.assertIsNotNone(finder.find())
|
||||||
|
@@ -1321,6 +1326,7 @@ class TestRootFsDeviceFinder(PsutilTestC
|
||||||
|
findmnt_value = sh("findmnt -o SOURCE -rn /")
|
||||||
|
self.assertEqual(psutil_value, findmnt_value)
|
||||||
|
|
||||||
|
+ @unittest.skip("Fails in OBS")
|
||||||
|
def test_disk_partitions_mocked(self):
|
||||||
|
with mock.patch(
|
||||||
|
'psutil._pslinux.cext.disk_partitions',
|
||||||
|
Index: psutil-5.9.1/psutil/tests/test_posix.py
|
||||||
===================================================================
|
===================================================================
|
||||||
--- psutil-5.9.0.orig/psutil/tests/test_posix.py
|
--- psutil-5.9.1.orig/psutil/tests/test_posix.py
|
||||||
+++ psutil-5.9.0/psutil/tests/test_posix.py
|
+++ psutil-5.9.1/psutil/tests/test_posix.py
|
||||||
@@ -377,7 +377,7 @@ class TestSystemAPIs(PsutilTestCase):
|
@@ -377,6 +377,7 @@ class TestSystemAPIs(PsutilTestCase):
|
||||||
# AIX can return '-' in df output instead of numbers, e.g. for /proc
|
# AIX can return '-' in df output instead of numbers, e.g. for /proc
|
||||||
@unittest.skipIf(AIX, "unreliable on AIX")
|
@unittest.skipIf(AIX, "unreliable on AIX")
|
||||||
@retry_on_failure()
|
@retry_on_failure()
|
||||||
- def test_disk_usage(self):
|
+ @unittest.skip("Fails in OBS")
|
||||||
+ def _test_disk_usage(self):
|
def test_disk_usage(self):
|
||||||
def df(device):
|
def df(device):
|
||||||
out = sh("df -k %s" % device).strip()
|
out = sh("df -k %s" % device).strip()
|
||||||
line = out.split('\n')[1]
|
Index: psutil-5.9.1/psutil/tests/test_system.py
|
||||||
Index: psutil-5.9.0/psutil/tests/test_system.py
|
|
||||||
===================================================================
|
===================================================================
|
||||||
--- psutil-5.9.0.orig/psutil/tests/test_system.py
|
--- psutil-5.9.1.orig/psutil/tests/test_system.py
|
||||||
+++ psutil-5.9.0/psutil/tests/test_system.py
|
+++ psutil-5.9.1/psutil/tests/test_system.py
|
||||||
@@ -200,6 +200,7 @@ class TestMiscAPIs(PsutilTestCase):
|
@@ -199,6 +199,7 @@ class TestMiscAPIs(PsutilTestCase):
|
||||||
self.assertLess(bt, time.time())
|
self.assertLess(bt, time.time())
|
||||||
|
|
||||||
@unittest.skipIf(CI_TESTING and not psutil.users(), "unreliable on CI")
|
@unittest.skipIf(CI_TESTING and not psutil.users(), "unreliable on CI")
|
||||||
+ @unittest.skipIf(True, "does not work on obs")
|
+ @unittest.skip("Fails in OBS")
|
||||||
def test_users(self):
|
def test_users(self):
|
||||||
users = psutil.users()
|
users = psutil.users()
|
||||||
self.assertNotEqual(users, [])
|
self.assertNotEqual(users, [])
|
||||||
@@ -580,7 +581,7 @@ class TestDiskAPIs(PsutilTestCase):
|
@@ -579,6 +580,7 @@ class TestDiskAPIs(PsutilTestCase):
|
||||||
def test_disk_usage_bytes(self):
|
def test_disk_usage_bytes(self):
|
||||||
psutil.disk_usage(b'.')
|
psutil.disk_usage(b'.')
|
||||||
|
|
||||||
- def test_disk_partitions(self):
|
+ @unittest.skip("Fails in OBS")
|
||||||
+ def _test_disk_partitions(self):
|
def test_disk_partitions(self):
|
||||||
def check_ntuple(nt):
|
def check_ntuple(nt):
|
||||||
self.assertIsInstance(nt.device, str)
|
self.assertIsInstance(nt.device, str)
|
||||||
self.assertIsInstance(nt.mountpoint, str)
|
Index: psutil-5.9.1/psutil/tests/test_contracts.py
|
||||||
Index: psutil-5.9.0/psutil/tests/test_contracts.py
|
|
||||||
===================================================================
|
===================================================================
|
||||||
--- psutil-5.9.0.orig/psutil/tests/test_contracts.py
|
--- psutil-5.9.1.orig/psutil/tests/test_contracts.py
|
||||||
+++ psutil-5.9.0/psutil/tests/test_contracts.py
|
+++ psutil-5.9.1/psutil/tests/test_contracts.py
|
||||||
@@ -246,6 +246,7 @@ class TestSystemAPITypes(PsutilTestCase)
|
@@ -246,6 +246,7 @@ class TestSystemAPITypes(PsutilTestCase)
|
||||||
self.assertIsInstance(k, str)
|
self.assertIsInstance(k, str)
|
||||||
self.assert_ntuple_of_nums(v, type_=(int, long))
|
self.assert_ntuple_of_nums(v, type_=(int, long))
|
||||||
|
|
||||||
+ @unittest.skipIf(True, "does not work on obs")
|
+ @unittest.skip("Fails in OBS")
|
||||||
def test_disk_partitions(self):
|
def test_disk_partitions(self):
|
||||||
# Duplicate of test_system.py. Keep it anyway.
|
# Duplicate of test_system.py. Keep it anyway.
|
||||||
for disk in psutil.disk_partitions():
|
for disk in psutil.disk_partitions():
|
||||||
Index: psutil-5.9.0/psutil/tests/test_process.py
|
Index: psutil-5.9.1/psutil/tests/test_process.py
|
||||||
===================================================================
|
===================================================================
|
||||||
--- psutil-5.9.0.orig/psutil/tests/test_process.py
|
--- psutil-5.9.1.orig/psutil/tests/test_process.py
|
||||||
+++ psutil-5.9.0/psutil/tests/test_process.py
|
+++ psutil-5.9.1/psutil/tests/test_process.py
|
||||||
@@ -343,6 +343,7 @@ class TestProcess(PsutilTestCase):
|
@@ -343,6 +343,7 @@ class TestProcess(PsutilTestCase):
|
||||||
|
|
||||||
@unittest.skipIf(not HAS_IONICE, "not supported")
|
@unittest.skipIf(not HAS_IONICE, "not supported")
|
||||||
@unittest.skipIf(not LINUX, "linux only")
|
@unittest.skipIf(not LINUX, "linux only")
|
||||||
+ @unittest.skipIf(True, "does not work reliably on obs")
|
+ @unittest.skip("Unreliable in OBS")
|
||||||
def test_ionice_linux(self):
|
def test_ionice_linux(self):
|
||||||
p = psutil.Process()
|
p = psutil.Process()
|
||||||
if not CI_TESTING:
|
if not CI_TESTING:
|
||||||
|
Reference in New Issue
Block a user