forked from pool/python-psutil
Accepting request 1041723 from home:bnavigator:branches:devel:languages:python
- Require unittest2 only for python2: make this suitable for the 15.4_py39 target in devel:languages:python:backports. - Merge skip-obs.patch into skip_failing_tests.patch and add test_linux.py::test_cpu_affinity because it depends on the obs vm-type or worker CPU. OBS-URL: https://build.opensuse.org/request/show/1041723 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-psutil?expand=0&rev=152
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Dec 8 19:55:50 UTC 2022 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Require unittest2 only for python2: make this suitable for
|
||||
the 15.4_py39 target in devel:languages:python:backports.
|
||||
- Merge skip-obs.patch into skip_failing_tests.patch and add
|
||||
test_linux.py::test_cpu_affinity because it depends on the
|
||||
obs vm-type or worker CPU.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Nov 7 20:52:52 UTC 2022 - Michael Ströder <michael@stroeder.com>
|
||||
|
||||
|
@@ -30,7 +30,6 @@ Summary: A process utilities module for Python
|
||||
License: BSD-3-Clause
|
||||
URL: https://github.com/giampaolo/psutil
|
||||
Source: https://files.pythonhosted.org/packages/source/p/psutil/psutil-%{version}.tar.gz
|
||||
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
|
||||
@@ -46,12 +45,10 @@ Requires: procps
|
||||
%if %{with test}
|
||||
BuildRequires: net-tools
|
||||
BuildRequires: procps
|
||||
%if 0%{?suse_version} < 1550
|
||||
BuildRequires: %{python_module unittest2}
|
||||
%endif
|
||||
%if %{with python2}
|
||||
BuildRequires: python-ipaddress
|
||||
BuildRequires: python-mock
|
||||
BuildRequires: python-unittest2
|
||||
%endif
|
||||
%endif
|
||||
%ifpython2
|
||||
|
136
skip-obs.patch
136
skip-obs.patch
@@ -1,136 +0,0 @@
|
||||
Index: psutil-5.9.1/psutil/tests/test_misc.py
|
||||
===================================================================
|
||||
--- psutil-5.9.1.orig/psutil/tests/test_misc.py
|
||||
+++ psutil-5.9.1/psutil/tests/test_misc.py
|
||||
@@ -252,6 +252,7 @@ class TestMisc(PsutilTestCase):
|
||||
|
||||
# XXX: https://github.com/pypa/setuptools/pull/2896
|
||||
@unittest.skipIf(APPVEYOR, "temporarily disabled due to setuptools bug")
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_setup_script(self):
|
||||
setup_py = os.path.join(ROOT_DIR, 'setup.py')
|
||||
if CI_TESTING and not os.path.exists(setup_py):
|
||||
@@ -745,6 +746,7 @@ class TestScripts(PsutilTestCase):
|
||||
src = f.read()
|
||||
ast.parse(src)
|
||||
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_coverage(self):
|
||||
# make sure all example scripts have a test method defined
|
||||
meths = dir(self)
|
||||
@@ -764,6 +766,7 @@ class TestScripts(PsutilTestCase):
|
||||
if not stat.S_IXUSR & os.stat(path)[stat.ST_MODE]:
|
||||
raise self.fail('%r is not executable' % path)
|
||||
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_disk_usage(self):
|
||||
self.assert_stdout('disk_usage.py')
|
||||
|
||||
Index: psutil-5.9.1/psutil/tests/test_linux.py
|
||||
===================================================================
|
||||
--- psutil-5.9.1.orig/psutil/tests/test_linux.py
|
||||
+++ psutil-5.9.1/psutil/tests/test_linux.py
|
||||
@@ -688,6 +688,7 @@ class TestSystemCPUCountLogical(PsutilTe
|
||||
self.assertEqual(psutil.cpu_count(logical=True), num)
|
||||
|
||||
@unittest.skipIf(not which("lscpu"), "lscpu utility not available")
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_against_lscpu(self):
|
||||
out = sh("lscpu -p")
|
||||
num = len([x for x in out.split('\n') if not x.startswith('#')])
|
||||
@@ -731,6 +732,7 @@ class TestSystemCPUCountLogical(PsutilTe
|
||||
class TestSystemCPUCountCores(PsutilTestCase):
|
||||
|
||||
@unittest.skipIf(not which("lscpu"), "lscpu utility not available")
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_against_lscpu(self):
|
||||
out = sh("lscpu -p")
|
||||
core_ids = set()
|
||||
@@ -1077,6 +1079,7 @@ class TestSystemDiskPartitions(PsutilTes
|
||||
|
||||
@unittest.skipIf(not hasattr(os, 'statvfs'), "os.statvfs() not available")
|
||||
@skip_on_not_implemented()
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_against_df(self):
|
||||
# test psutil.disk_usage() and psutil.disk_partitions()
|
||||
# against "df -a"
|
||||
@@ -1251,6 +1254,7 @@ class TestSystemDiskIoCounters(PsutilTes
|
||||
self.assertEqual(ret.read_count, 1)
|
||||
self.assertEqual(ret.write_count, 5)
|
||||
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_emulate_use_sysfs(self):
|
||||
def exists(path):
|
||||
if path == '/proc/diskstats':
|
||||
@@ -1294,6 +1298,7 @@ class TestRootFsDeviceFinder(PsutilTestC
|
||||
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.1.orig/psutil/tests/test_posix.py
|
||||
+++ psutil-5.9.1/psutil/tests/test_posix.py
|
||||
@@ -377,6 +377,7 @@ class TestSystemAPIs(PsutilTestCase):
|
||||
# AIX can return '-' in df output instead of numbers, e.g. for /proc
|
||||
@unittest.skipIf(AIX, "unreliable on AIX")
|
||||
@retry_on_failure()
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_disk_usage(self):
|
||||
def df(device):
|
||||
out = sh("df -k %s" % device).strip()
|
||||
Index: psutil-5.9.1/psutil/tests/test_system.py
|
||||
===================================================================
|
||||
--- psutil-5.9.1.orig/psutil/tests/test_system.py
|
||||
+++ psutil-5.9.1/psutil/tests/test_system.py
|
||||
@@ -199,6 +199,7 @@ class TestMiscAPIs(PsutilTestCase):
|
||||
self.assertLess(bt, time.time())
|
||||
|
||||
@unittest.skipIf(CI_TESTING and not psutil.users(), "unreliable on CI")
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_users(self):
|
||||
users = psutil.users()
|
||||
self.assertNotEqual(users, [])
|
||||
@@ -579,6 +580,7 @@ class TestDiskAPIs(PsutilTestCase):
|
||||
def test_disk_usage_bytes(self):
|
||||
psutil.disk_usage(b'.')
|
||||
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_disk_partitions(self):
|
||||
def check_ntuple(nt):
|
||||
self.assertIsInstance(nt.device, str)
|
||||
Index: psutil-5.9.1/psutil/tests/test_contracts.py
|
||||
===================================================================
|
||||
--- psutil-5.9.1.orig/psutil/tests/test_contracts.py
|
||||
+++ psutil-5.9.1/psutil/tests/test_contracts.py
|
||||
@@ -246,6 +246,7 @@ class TestSystemAPITypes(PsutilTestCase)
|
||||
self.assertIsInstance(k, str)
|
||||
self.assert_ntuple_of_nums(v, type_=(int, long))
|
||||
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_disk_partitions(self):
|
||||
# Duplicate of test_system.py. Keep it anyway.
|
||||
for disk in psutil.disk_partitions():
|
||||
Index: psutil-5.9.1/psutil/tests/test_process.py
|
||||
===================================================================
|
||||
--- psutil-5.9.1.orig/psutil/tests/test_process.py
|
||||
+++ psutil-5.9.1/psutil/tests/test_process.py
|
||||
@@ -343,6 +343,7 @@ class TestProcess(PsutilTestCase):
|
||||
|
||||
@unittest.skipIf(not HAS_IONICE, "not supported")
|
||||
@unittest.skipIf(not LINUX, "linux only")
|
||||
+ @unittest.skip("Unreliable in OBS")
|
||||
def test_ionice_linux(self):
|
||||
p = psutil.Process()
|
||||
if not CI_TESTING:
|
@@ -1,10 +1,84 @@
|
||||
---
|
||||
psutil/tests/test_linux.py | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- a/psutil/tests/test_linux.py
|
||||
+++ b/psutil/tests/test_linux.py
|
||||
@@ -1614,6 +1614,8 @@ class TestSensorsBattery(PsutilTestCase)
|
||||
Index: psutil-5.9.4/psutil/tests/test_misc.py
|
||||
===================================================================
|
||||
--- psutil-5.9.4.orig/psutil/tests/test_misc.py
|
||||
+++ psutil-5.9.4/psutil/tests/test_misc.py
|
||||
@@ -252,6 +252,7 @@ class TestMisc(PsutilTestCase):
|
||||
|
||||
# XXX: https://github.com/pypa/setuptools/pull/2896
|
||||
@unittest.skipIf(APPVEYOR, "temporarily disabled due to setuptools bug")
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_setup_script(self):
|
||||
setup_py = os.path.join(ROOT_DIR, 'setup.py')
|
||||
if CI_TESTING and not os.path.exists(setup_py):
|
||||
@@ -745,6 +746,7 @@ class TestScripts(PsutilTestCase):
|
||||
src = f.read()
|
||||
ast.parse(src)
|
||||
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_coverage(self):
|
||||
# make sure all example scripts have a test method defined
|
||||
meths = dir(self)
|
||||
@@ -764,6 +766,7 @@ class TestScripts(PsutilTestCase):
|
||||
if not stat.S_IXUSR & os.stat(path)[stat.ST_MODE]:
|
||||
raise self.fail('%r is not executable' % path)
|
||||
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_disk_usage(self):
|
||||
self.assert_stdout('disk_usage.py')
|
||||
|
||||
Index: psutil-5.9.4/psutil/tests/test_linux.py
|
||||
===================================================================
|
||||
--- psutil-5.9.4.orig/psutil/tests/test_linux.py
|
||||
+++ psutil-5.9.4/psutil/tests/test_linux.py
|
||||
@@ -688,6 +688,7 @@ class TestSystemCPUCountLogical(PsutilTe
|
||||
self.assertEqual(psutil.cpu_count(logical=True), num)
|
||||
|
||||
@unittest.skipIf(not which("lscpu"), "lscpu utility not available")
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_against_lscpu(self):
|
||||
out = sh("lscpu -p")
|
||||
num = len([x for x in out.split('\n') if not x.startswith('#')])
|
||||
@@ -731,6 +732,7 @@ class TestSystemCPUCountLogical(PsutilTe
|
||||
class TestSystemCPUCountCores(PsutilTestCase):
|
||||
|
||||
@unittest.skipIf(not which("lscpu"), "lscpu utility not available")
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_against_lscpu(self):
|
||||
out = sh("lscpu -p")
|
||||
core_ids = set()
|
||||
@@ -1109,6 +1111,7 @@ class TestSystemDiskPartitions(PsutilTes
|
||||
|
||||
@unittest.skipIf(not hasattr(os, 'statvfs'), "os.statvfs() not available")
|
||||
@skip_on_not_implemented()
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_against_df(self):
|
||||
# test psutil.disk_usage() and psutil.disk_partitions()
|
||||
# against "df -a"
|
||||
@@ -1283,6 +1286,7 @@ class TestSystemDiskIoCounters(PsutilTes
|
||||
self.assertEqual(ret.read_count, 1)
|
||||
self.assertEqual(ret.write_count, 5)
|
||||
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_emulate_use_sysfs(self):
|
||||
def exists(path):
|
||||
if path == '/proc/diskstats':
|
||||
@@ -1326,6 +1330,7 @@ class TestRootFsDeviceFinder(PsutilTestC
|
||||
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())
|
||||
@@ -1353,6 +1358,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',
|
||||
@@ -1651,6 +1657,8 @@ class TestSensorsBattery(PsutilTestCase)
|
||||
self.assertIsNone(psutil.sensors_battery().power_plugged)
|
||||
assert m.called
|
||||
|
||||
@@ -13,7 +87,7 @@
|
||||
def test_emulate_energy_full_0(self):
|
||||
# Emulate a case where energy_full files returns 0.
|
||||
with mock_open_content(
|
||||
@@ -1621,6 +1623,8 @@ class TestSensorsBattery(PsutilTestCase)
|
||||
@@ -1658,6 +1666,8 @@ class TestSensorsBattery(PsutilTestCase)
|
||||
self.assertEqual(psutil.sensors_battery().percent, 0)
|
||||
assert m.called
|
||||
|
||||
@@ -22,3 +96,67 @@
|
||||
def test_emulate_energy_full_not_avail(self):
|
||||
# Emulate a case where energy_full file does not exist.
|
||||
# Expected fallback on /capacity.
|
||||
@@ -2250,6 +2260,7 @@ class TestProcessAgainstStatus(PsutilTes
|
||||
value = self.read_status_file("nonvoluntary_ctxt_switches:")
|
||||
self.assertEqual(self.proc.num_ctx_switches().involuntary, value)
|
||||
|
||||
+ @unittest.skip("Fails in certain OBS environments")
|
||||
def test_cpu_affinity(self):
|
||||
value = self.read_status_file("Cpus_allowed_list:")
|
||||
if '-' in str(value):
|
||||
Index: psutil-5.9.4/psutil/tests/test_posix.py
|
||||
===================================================================
|
||||
--- psutil-5.9.4.orig/psutil/tests/test_posix.py
|
||||
+++ psutil-5.9.4/psutil/tests/test_posix.py
|
||||
@@ -383,6 +383,7 @@ class TestSystemAPIs(PsutilTestCase):
|
||||
# AIX can return '-' in df output instead of numbers, e.g. for /proc
|
||||
@unittest.skipIf(AIX, "unreliable on AIX")
|
||||
@retry_on_failure()
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_disk_usage(self):
|
||||
def df(device):
|
||||
out = sh("df -k %s" % device).strip()
|
||||
Index: psutil-5.9.4/psutil/tests/test_system.py
|
||||
===================================================================
|
||||
--- psutil-5.9.4.orig/psutil/tests/test_system.py
|
||||
+++ psutil-5.9.4/psutil/tests/test_system.py
|
||||
@@ -201,6 +201,7 @@ class TestMiscAPIs(PsutilTestCase):
|
||||
self.assertLess(bt, time.time())
|
||||
|
||||
@unittest.skipIf(CI_TESTING and not psutil.users(), "unreliable on CI")
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_users(self):
|
||||
users = psutil.users()
|
||||
self.assertNotEqual(users, [])
|
||||
@@ -586,6 +587,7 @@ class TestDiskAPIs(PsutilTestCase):
|
||||
def test_disk_usage_bytes(self):
|
||||
psutil.disk_usage(b'.')
|
||||
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_disk_partitions(self):
|
||||
def check_ntuple(nt):
|
||||
self.assertIsInstance(nt.device, str)
|
||||
Index: psutil-5.9.4/psutil/tests/test_contracts.py
|
||||
===================================================================
|
||||
--- psutil-5.9.4.orig/psutil/tests/test_contracts.py
|
||||
+++ psutil-5.9.4/psutil/tests/test_contracts.py
|
||||
@@ -251,6 +251,7 @@ class TestSystemAPITypes(PsutilTestCase)
|
||||
self.assertIsInstance(k, str)
|
||||
self.assert_ntuple_of_nums(v, type_=(int, long))
|
||||
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
def test_disk_partitions(self):
|
||||
# Duplicate of test_system.py. Keep it anyway.
|
||||
for disk in psutil.disk_partitions():
|
||||
Index: psutil-5.9.4/psutil/tests/test_process.py
|
||||
===================================================================
|
||||
--- psutil-5.9.4.orig/psutil/tests/test_process.py
|
||||
+++ psutil-5.9.4/psutil/tests/test_process.py
|
||||
@@ -344,6 +344,7 @@ class TestProcess(PsutilTestCase):
|
||||
|
||||
@unittest.skipIf(not HAS_IONICE, "not supported")
|
||||
@unittest.skipIf(not LINUX, "linux only")
|
||||
+ @unittest.skip("Unreliable in OBS")
|
||||
def test_ionice_linux(self):
|
||||
p = psutil.Process()
|
||||
if not CI_TESTING:
|
||||
|
Reference in New Issue
Block a user