Update to 5.9.8

This commit is contained in:
Miro Hrončok 2024-02-09 14:32:48 +01:00
parent 548bf711de
commit e2378f43a6
5 changed files with 60 additions and 104 deletions

View File

@ -1,12 +0,0 @@
diff --git a/psutil/_psutil_linux.c b/psutil/_psutil_linux.c
index a6ee602..56fd4f6 100644
--- a/psutil/_psutil_linux.c
+++ b/psutil/_psutil_linux.c
@@ -24,6 +24,7 @@
#include <linux/sockios.h>
#include <linux/if.h>
#include <sys/resource.h>
+#include <unistd.h>
// see: https://github.com/giampaolo/psutil/issues/659
#ifdef PSUTIL_ETHTOOL_MISSING_TYPES

View File

@ -1,18 +1,8 @@
diff -uNr psutil-release-5.9.5.orig/psutil/tests/test_contracts.py psutil-release-5.9.5/psutil/tests/test_contracts.py
--- psutil-release-5.9.5.orig/psutil/tests/test_contracts.py 2023-08-04 06:14:41.080097504 -0500
+++ psutil-release-5.9.5/psutil/tests/test_contracts.py 2023-08-04 06:36:02.844609234 -0500
@@ -425,6 +425,7 @@
ls.append(proc_info(pid))
return ls
+ @unittest.skip("Unreliable in mock")
def test_all(self):
failures = []
for info in self.iter_proc_info():
diff -uNr psutil-release-5.9.5.orig/psutil/tests/test_linux.py psutil-release-5.9.5/psutil/tests/test_linux.py
--- psutil-release-5.9.5.orig/psutil/tests/test_linux.py 2023-08-04 06:14:41.080097504 -0500
+++ psutil-release-5.9.5/psutil/tests/test_linux.py 2023-08-04 08:32:44.666822057 -0500
@@ -257,7 +257,7 @@
diff --git a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py
index 0aa04f1..1096d3c 100755
--- a/psutil/tests/test_linux.py
+++ b/psutil/tests/test_linux.py
@@ -272,7 +272,7 @@ class TestSystemVirtualMemoryAgainstFree(PsutilTestCase):
psutil_value = psutil.virtual_memory().total
self.assertEqual(cli_value, psutil_value)
@ -21,31 +11,35 @@ diff -uNr psutil-release-5.9.5.orig/psutil/tests/test_linux.py psutil-release-5.
def test_used(self):
# Older versions of procps used slab memory to calculate used memory.
# This got changed in:
@@ -314,6 +314,7 @@
vmstat_value, psutil_value, delta=TOLERANCE_SYS_MEM)
@@ -337,6 +337,7 @@ class TestSystemVirtualMemoryAgainstVmstat(PsutilTestCase):
)
@retry_on_failure()
+ @unittest.skip("Unreliable in mock")
def test_used(self):
# Older versions of procps used slab memory to calculate used memory.
# This got changed in:
@@ -691,8 +692,7 @@
@@ -717,10 +718,7 @@ class TestSystemCPUTimes(PsutilTestCase):
@unittest.skipIf(not LINUX, "LINUX only")
class TestSystemCPUCountLogical(PsutilTestCase):
- @unittest.skipIf(not os.path.exists("/sys/devices/system/cpu/online"),
- "/sys/devices/system/cpu/online does not exist")
- @unittest.skipIf(
- not os.path.exists("/sys/devices/system/cpu/online"),
- "/sys/devices/system/cpu/online does not exist",
- )
+ @unittest.skip("Unreliable on mock")
def test_against_sysdev_cpu_online(self):
with open("/sys/devices/system/cpu/online") as f:
value = f.read().strip()
@@ -700,14 +700,13 @@
@@ -728,16 +726,13 @@ class TestSystemCPUCountLogical(PsutilTestCase):
value = int(value.split('-')[1]) + 1
self.assertEqual(psutil.cpu_count(), value)
- @unittest.skipIf(not os.path.exists("/sys/devices/system/cpu"),
- "/sys/devices/system/cpu does not exist")
+ @unittest.skip("Unreliable in mock on ppc64le")
- @unittest.skipIf(
- not os.path.exists("/sys/devices/system/cpu"),
- "/sys/devices/system/cpu does not exist",
- )
+ @unittest.skip("Unreliable on mock")
def test_against_sysdev_cpu_num(self):
ls = os.listdir("/sys/devices/system/cpu")
count = len([x for x in ls if re.search(r"cpu\d+$", x) is not None])
@ -56,26 +50,26 @@ diff -uNr psutil-release-5.9.5.orig/psutil/tests/test_linux.py psutil-release-5.
def test_against_nproc(self):
num = int(sh("nproc --all"))
self.assertEqual(psutil.cpu_count(logical=True), num)
@@ -752,7 +751,7 @@
@@ -785,7 +780,7 @@ class TestSystemCPUCountLogical(PsutilTestCase):
assert m.called
-@unittest.skipIf(not LINUX, "LINUX only")
+@unittest.skip("Unreliable on mock")
class TestSystemCPUCountCores(PsutilTestCase):
@unittest.skipIf(not which("lscpu"), "lscpu utility not available")
@@ -784,7 +783,7 @@
def test_against_lscpu(self):
@@ -815,7 +810,7 @@ class TestSystemCPUCountCores(PsutilTestCase):
@unittest.skipIf(not LINUX, "LINUX only")
class TestSystemCPUFrequency(PsutilTestCase):
- @unittest.skipIf(not HAS_CPU_FREQ, "not supported")
+ @unittest.skip("Unreliable on mock")
def test_emulate_use_second_file(self):
# https://github.com/giampaolo/psutil/issues/981
def path_exists_mock(path):
@@ -798,7 +797,7 @@
create=True):
@@ -830,7 +825,7 @@ class TestSystemCPUFrequency(PsutilTestCase):
):
assert psutil.cpu_freq()
- @unittest.skipIf(not HAS_CPU_FREQ, "not supported")
@ -83,25 +77,25 @@ diff -uNr psutil-release-5.9.5.orig/psutil/tests/test_linux.py psutil-release-5.
def test_emulate_use_cpuinfo(self):
# Emulate a case where /sys/devices/system/cpu/cpufreq* does not
# exist and /proc/cpuinfo is used instead.
@@ -923,7 +922,7 @@
@@ -964,7 +959,7 @@ class TestSystemCPUFrequency(PsutilTestCase):
self.assertEqual(freq.current, 200)
-@unittest.skipIf(not LINUX, "LINUX only")
+@unittest.skip("Unreliable on mock")
class TestSystemCPUStats(PsutilTestCase):
def test_ctx_switches(self):
@@ -956,7 +955,7 @@
vmstat_value = vmstat("context switches")
@@ -995,7 +990,7 @@ class TestLoadAvg(PsutilTestCase):
# =====================================================================
-@unittest.skipIf(not LINUX, "LINUX only")
+@unittest.skip("Unreliable on mock")
class TestSystemNetIfAddrs(PsutilTestCase):
def test_ips(self):
@@ -1350,7 +1349,7 @@
for name, addrs in psutil.net_if_addrs().items():
@@ -1404,7 +1399,7 @@ class TestRootFsDeviceFinder(PsutilTestCase):
self.assertRaises(FileNotFoundError, finder.ask_sys_dev_block)
finder.ask_sys_class_block()
@ -110,7 +104,7 @@ diff -uNr psutil-release-5.9.5.orig/psutil/tests/test_linux.py psutil-release-5.
def test_comparisons(self):
finder = RootFsDeviceFinder()
self.assertIsNotNone(finder.find())
@@ -1373,11 +1372,13 @@
@@ -1428,11 +1423,13 @@ class TestRootFsDeviceFinder(PsutilTestCase):
@unittest.skipIf(not which("findmnt"), "findmnt utility not available")
@unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
@ -123,16 +117,16 @@ diff -uNr psutil-release-5.9.5.orig/psutil/tests/test_linux.py psutil-release-5.
+ @unittest.skip("Unreliable on mock")
def test_disk_partitions_mocked(self):
with mock.patch(
'psutil._pslinux.cext.disk_partitions',
@@ -1513,6 +1514,7 @@
psutil._pslinux.boot_time)
assert m.called
'psutil._pslinux.cext.disk_partitions',
@@ -2112,6 +2109,7 @@ class TestProcess(PsutilTestCase):
with mock.patch(patch_point, side_effect=open_mock_2):
self.assertRaises(psutil.AccessDenied, psutil.Process().threads)
+ @unittest.skip("Unreliable on mock")
def test_users_mocked(self):
# Make sure ':0' and ':0.0' (returned by C ext) are converted
# to 'localhost'.
@@ -2275,6 +2277,7 @@
def test_exe_mocked(self):
with mock.patch(
'psutil._pslinux.readlink', side_effect=OSError(errno.ENOENT, "")
@@ -2313,6 +2311,7 @@ class TestProcessAgainstStatus(PsutilTestCase):
value = self.read_status_file("nonvoluntary_ctxt_switches:")
self.assertEqual(self.proc.num_ctx_switches().involuntary, value)
@ -140,25 +134,28 @@ diff -uNr psutil-release-5.9.5.orig/psutil/tests/test_linux.py psutil-release-5.
def test_cpu_affinity(self):
value = self.read_status_file("Cpus_allowed_list:")
if '-' in str(value):
diff -uNr psutil-release-5.9.5.orig/psutil/tests/test_system.py psutil-release-5.9.5/psutil/tests/test_system.py
--- psutil-release-5.9.5.orig/psutil/tests/test_system.py 2023-08-04 06:14:41.080097504 -0500
+++ psutil-release-5.9.5/psutil/tests/test_system.py 2023-08-04 08:18:37.164817563 -0500
@@ -512,10 +512,7 @@
diff --git a/psutil/tests/test_system.py b/psutil/tests/test_system.py
index 152e378..35542f5 100755
--- a/psutil/tests/test_system.py
+++ b/psutil/tests/test_system.py
@@ -561,11 +561,7 @@ class TestCpuAPIs(PsutilTestCase):
if not AIX and name in ('ctx_switches', 'interrupts'):
self.assertGreater(value, 0)
- # TODO: remove this once 1892 is fixed
- @unittest.skipIf(MACOS and platform.machine() == 'arm64',
- "skipped due to #1892")
- @unittest.skipIf(
- MACOS and platform.machine() == 'arm64', "skipped due to #1892"
- )
- @unittest.skipIf(not HAS_CPU_FREQ, "not supported")
+ @unittest.skip("Unreliable on mock")
def test_cpu_freq(self):
def check_ls(ls):
for nt in ls:
diff -uNr psutil-release-5.9.5.orig/psutil/tests/test_testutils.py psutil-release-5.9.5/psutil/tests/test_testutils.py
--- psutil-release-5.9.5.orig/psutil/tests/test_testutils.py 2023-08-04 06:14:41.080097504 -0500
+++ psutil-release-5.9.5/psutil/tests/test_testutils.py 2023-08-04 06:35:41.421931668 -0500
@@ -370,7 +370,7 @@
diff --git a/psutil/tests/test_testutils.py b/psutil/tests/test_testutils.py
index a93f9f0..59ae083 100755
--- a/psutil/tests/test_testutils.py
+++ b/psutil/tests/test_testutils.py
@@ -373,7 +373,7 @@ class TestMemLeakClass(TestMemoryLeak):
self.assertRaises(ValueError, self.execute, lambda: 0, retries=-1)
@retry_on_failure()

View File

@ -1,22 +0,0 @@
diff --git a/psutil/tests/test_system.py b/psutil/tests/test_system.py
index 3b787ee..db22245 100755
--- a/psutil/tests/test_system.py
+++ b/psutil/tests/test_system.py
@@ -346,7 +346,7 @@ class TestCpuAPIs(PsutilTestCase):
self.assertIsInstance(cp_time, float)
self.assertGreaterEqual(cp_time, 0.0)
total += cp_time
- self.assertEqual(total, sum(times))
+ self.assertAlmostEqual(total, sum(times))
str(times)
# CPU times are always supposed to increase over time
# or at least remain the same and that's because time
@@ -385,7 +385,7 @@ class TestCpuAPIs(PsutilTestCase):
self.assertIsInstance(cp_time, float)
self.assertGreaterEqual(cp_time, 0.0)
total += cp_time
- self.assertEqual(total, sum(times))
+ self.assertAlmostEqual(total, sum(times))
str(times)
self.assertEqual(len(psutil.cpu_times(percpu=True)[0]),
len(psutil.cpu_times(percpu=False)))

View File

@ -1,26 +1,15 @@
Name: python-psutil
Version: 5.9.5
Release: 4%{?dist}
Version: 5.9.8
Release: 1%{?dist}
Summary: A process and system utilities module for Python
License: BSD-3-Clause
URL: https://github.com/giampaolo/psutil
Source: %{url}/archive/release-%{version}/psutil-%{version}.tar.gz
#
# skip 2 tests that fail in mock chroots
# skip tests that fail in mock chroots
#
Patch: python-psutil-skip-tests-in-mock.patch
#
# avoid: AssertionError: 7883822.420000001 != 7883822.42
#
Patch: python-psutil-test-sum-floats-via-almost-equal.patch
#
# include unistd.h to avoid (on Python 3.13+):
# error: implicit declaration of function syscall
# error: implicit declaration of function close
# upstream PR: https://github.com/giampaolo/psutil/pull/2321
#
Patch: python-psutil-include-unistd.h.patch
BuildRequires: gcc
BuildRequires: sed
@ -103,6 +92,10 @@ APPVEYOR=1 %{py3_test_envvars} %{python3} psutil/tests/runner.py
%changelog
* Fri Feb 09 2024 Miro Hrončok <mhroncok@redhat.com> - 5.9.8-1
- Update to 5.9.8
- Fixes: rhbz#2244271
* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.9.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

View File

@ -1 +1 @@
SHA512 (psutil-5.9.5.tar.gz) = b9872acbecd1d9a9a79f032bd375ff0f10be4574e5f76f904c7a6367d7d3e24e7f0a1d06affa2fafbea74ecb594017029bdf29fdb8a8d37aeb51fb0016c3339c
SHA512 (psutil-5.9.8.tar.gz) = 9943adcf4cdb333c729765fef9e3cc7623ef90cfdf8c91fcb8093c45a6978efa9f749b1f1818dde99a772b89e9dd86c3d7cc5f8f1047bf8782d00a30d9284c7f