Compare commits

..

No commits in common. "c10s" and "c8-stream-3.8" have entirely different histories.

15 changed files with 719 additions and 507 deletions

View File

@ -1 +0,0 @@
1

2
.gitignore vendored
View File

@ -1 +1 @@
psutil-*.tar.gz SOURCES/psutil-5.6.4.tar.gz

1
.python-psutil.metadata Normal file
View File

@ -0,0 +1 @@
038eebeacabe8f11215961aae307818e4c5af85b SOURCES/psutil-5.6.4.tar.gz

View File

@ -1,54 +0,0 @@
From 7664f36157268dba47313043da27761727c813ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Fri, 9 Feb 2024 14:55:41 +0100
Subject: [PATCH] Tests: Compare floats less strictly
We see:
======================================================================
FAIL: psutil.tests.test_system.TestCpuAPIs.test_cpu_times
----------------------------------------------------------------------
Traceback (most recent call last):
File "/builddir/build/BUILD/psutil-release-5.9.5/psutil/tests/test_system.py", line 351, in test_cpu_times
self.assertAlmostEqual(total, sum(times))
AssertionError: 885725913.3 != 885725913.3000001 within 7 places (1.1920928955078125e-07 difference)
----------------------------------------------------------------------
Or:
======================================================================
FAIL: psutil.tests.test_system.TestCpuAPIs.test_cpu_times
----------------------------------------------------------------------
Traceback (most recent call last):
File "/builddir/build/BUILD/psutil-release-5.9.5/psutil/tests/test_system.py", line 351, in test_cpu_times
self.assertAlmostEqual(total, sum(times))
AssertionError: 324284741.90999997 != 324284741.91 within 7 places (5.960464477539063e-08 difference)
----------------------------------------------------------------------
In CentOS Stream 10 builds on i686 and x86_64.
---
psutil/tests/test_system.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/psutil/tests/test_system.py b/psutil/tests/test_system.py
index 6656c19ba..56979c927 100755
--- a/psutil/tests/test_system.py
+++ b/psutil/tests/test_system.py
@@ -385,7 +385,7 @@ def test_cpu_times(self):
self.assertIsInstance(cp_time, float)
self.assertGreaterEqual(cp_time, 0.0)
total += cp_time
- self.assertAlmostEqual(total, sum(times))
+ self.assertAlmostEqual(total, sum(times), places=6)
str(times)
# CPU times are always supposed to increase over time
# or at least remain the same and that's because time
@@ -424,7 +424,7 @@ def test_per_cpu_times(self):
self.assertIsInstance(cp_time, float)
self.assertGreaterEqual(cp_time, 0.0)
total += cp_time
- self.assertAlmostEqual(total, sum(times))
+ self.assertAlmostEqual(total, sum(times), places=6)
str(times)
self.assertEqual(
len(psutil.cpu_times(percpu=True)[0]),

View File

@ -0,0 +1,617 @@
diff --git a/psutil/_psutil_aix.c b/psutil/_psutil_aix.c
index 8c055a4..9f58f60 100644
--- a/psutil/_psutil_aix.c
+++ b/psutil/_psutil_aix.c
@@ -265,8 +265,8 @@ psutil_proc_environ(PyObject *self, PyObject *args) {
goto error;
if (PyDict_SetItem(py_retdict, py_key, py_val))
goto error;
- Py_DECREF(py_key);
- Py_DECREF(py_val);
+ Py_CLEAR(py_key);
+ Py_CLEAR(py_val);
}
curvar = strchr(curvar, '\0') + 1;
}
@@ -510,10 +510,10 @@ psutil_users(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_username);
- Py_DECREF(py_tty);
- Py_DECREF(py_hostname);
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_username);
+ Py_CLEAR(py_tty);
+ Py_CLEAR(py_hostname);
+ Py_CLEAR(py_tuple);
}
endutxent();
@@ -570,9 +570,9 @@ psutil_disk_partitions(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_dev);
- Py_DECREF(py_mountp);
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_dev);
+ Py_CLEAR(py_mountp);
+ Py_CLEAR(py_tuple);
mt = getmntent(file);
}
endmntent(file);
diff --git a/psutil/_psutil_bsd.c b/psutil/_psutil_bsd.c
index b4264ce..7f1c492 100644
--- a/psutil/_psutil_bsd.c
+++ b/psutil/_psutil_bsd.c
@@ -154,7 +154,7 @@ psutil_pids(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_pid))
goto error;
- Py_DECREF(py_pid);
+ Py_CLEAR(py_pid);
proclist++;
}
free(orig_address);
@@ -507,8 +507,8 @@ psutil_proc_open_files(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_path);
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_path);
+ Py_CLEAR(py_tuple);
}
}
free(freep);
@@ -670,9 +670,9 @@ psutil_disk_partitions(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_dev);
- Py_DECREF(py_mountp);
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_dev);
+ Py_CLEAR(py_mountp);
+ Py_CLEAR(py_tuple);
}
free(fs);
@@ -765,7 +765,7 @@ psutil_net_io_counters(PyObject *self, PyObject *args) {
goto error;
if (PyDict_SetItemString(py_retdict, ifc_name, py_ifc_info))
goto error;
- Py_DECREF(py_ifc_info);
+ Py_CLEAR(py_ifc_info);
}
else {
continue;
@@ -840,10 +840,10 @@ psutil_users(PyObject *self, PyObject *args) {
fclose(fp);
goto error;
}
- Py_DECREF(py_username);
- Py_DECREF(py_tty);
- Py_DECREF(py_hostname);
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_username);
+ Py_CLEAR(py_tty);
+ Py_CLEAR(py_hostname);
+ Py_CLEAR(py_tuple);
}
fclose(fp);
@@ -883,10 +883,10 @@ psutil_users(PyObject *self, PyObject *args) {
endutxent();
goto error;
}
- Py_DECREF(py_username);
- Py_DECREF(py_tty);
- Py_DECREF(py_hostname);
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_username);
+ Py_CLEAR(py_tty);
+ Py_CLEAR(py_hostname);
+ Py_CLEAR(py_tuple);
}
endutxent();
diff --git a/psutil/_psutil_linux.c b/psutil/_psutil_linux.c
index 717723d..0d16eb4 100644
--- a/psutil/_psutil_linux.c
+++ b/psutil/_psutil_linux.c
@@ -241,9 +241,9 @@ psutil_disk_partitions(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_dev);
- Py_DECREF(py_mountp);
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_dev);
+ Py_CLEAR(py_mountp);
+ Py_CLEAR(py_tuple);
}
endmntent(file);
return py_retlist;
@@ -454,10 +454,10 @@ psutil_users(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_username);
- Py_DECREF(py_tty);
- Py_DECREF(py_hostname);
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_username);
+ Py_CLEAR(py_tty);
+ Py_CLEAR(py_hostname);
+ Py_CLEAR(py_tuple);
}
endutent();
return py_retlist;
diff --git a/psutil/_psutil_osx.c b/psutil/_psutil_osx.c
index d2ca94b..76ec0ee 100644
--- a/psutil/_psutil_osx.c
+++ b/psutil/_psutil_osx.c
@@ -138,7 +138,7 @@ psutil_pids(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_pid))
goto error;
- Py_DECREF(py_pid);
+ Py_CLEAR(py_pid);
proclist++;
}
free(orig_address);
@@ -653,7 +653,7 @@ psutil_per_cpu_times(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_cputime))
goto error;
- Py_DECREF(py_cputime);
+ Py_CLEAR(py_cputime);
}
ret = vm_deallocate(mach_task_self(), (vm_address_t)info_array,
@@ -841,9 +841,9 @@ psutil_disk_partitions(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_dev);
- Py_DECREF(py_mountp);
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_dev);
+ Py_CLEAR(py_mountp);
+ Py_CLEAR(py_tuple);
}
free(fs);
@@ -911,7 +911,6 @@ psutil_proc_threads(PyObject *self, PyObject *args) {
}
for (j = 0; j < thread_count; j++) {
- py_tuple = NULL;
thread_info_count = THREAD_INFO_MAX;
kr = thread_info(thread_list[j], THREAD_BASIC_INFO,
(thread_info_t)thinfo_basic, &thread_info_count);
@@ -934,7 +933,7 @@ psutil_proc_threads(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_tuple);
}
ret = vm_deallocate(task, (vm_address_t)thread_list,
@@ -1043,10 +1042,8 @@ psutil_proc_open_files(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_tuple);
- py_tuple = NULL;
- Py_DECREF(py_path);
- py_path = NULL;
+ Py_CLEAR(py_tuple);
+ Py_CLEAR(py_path);
// --- /construct python list
}
}
@@ -1226,7 +1223,7 @@ psutil_proc_connections(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_tuple);
}
else if (family == AF_UNIX) {
py_laddr = PyUnicode_DecodeFSDefault(
@@ -1248,9 +1245,9 @@ psutil_proc_connections(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_tuple);
- Py_DECREF(py_laddr);
- Py_DECREF(py_raddr);
+ Py_CLEAR(py_tuple);
+ Py_CLEAR(py_laddr);
+ Py_CLEAR(py_raddr);
}
}
}
@@ -1370,7 +1367,7 @@ psutil_net_io_counters(PyObject *self, PyObject *args) {
goto error;
if (PyDict_SetItemString(py_retdict, ifc_name, py_ifc_info))
goto error;
- Py_DECREF(py_ifc_info);
+ Py_CLEAR(py_ifc_info);
}
else {
continue;
@@ -1543,7 +1540,7 @@ psutil_disk_io_counters(PyObject *self, PyObject *args) {
goto error;
if (PyDict_SetItemString(py_retdict, disk_name, py_disk_info))
goto error;
- Py_DECREF(py_disk_info);
+ Py_CLEAR(py_disk_info);
CFRelease(parent_dict);
IOObjectRelease(parent);
@@ -1605,10 +1602,10 @@ psutil_users(PyObject *self, PyObject *args) {
endutxent();
goto error;
}
- Py_DECREF(py_username);
- Py_DECREF(py_tty);
- Py_DECREF(py_hostname);
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_username);
+ Py_CLEAR(py_tty);
+ Py_CLEAR(py_hostname);
+ Py_CLEAR(py_tuple);
}
endutxent();
diff --git a/psutil/_psutil_posix.c b/psutil/_psutil_posix.c
index 209e787..aa60084 100644
--- a/psutil/_psutil_posix.c
+++ b/psutil/_psutil_posix.c
@@ -324,11 +324,11 @@ psutil_net_if_addrs(PyObject* self, PyObject* args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_tuple);
- Py_DECREF(py_address);
- Py_DECREF(py_netmask);
- Py_DECREF(py_broadcast);
- Py_DECREF(py_ptp);
+ Py_CLEAR(py_tuple);
+ Py_CLEAR(py_address);
+ Py_CLEAR(py_netmask);
+ Py_CLEAR(py_broadcast);
+ Py_CLEAR(py_ptp);
}
freeifaddrs(ifaddr);
diff --git a/psutil/_psutil_sunos.c b/psutil/_psutil_sunos.c
index 919e76d..31d6f36 100644
--- a/psutil/_psutil_sunos.c
+++ b/psutil/_psutil_sunos.c
@@ -300,8 +300,8 @@ psutil_proc_environ(PyObject *self, PyObject *args) {
if (PyDict_SetItem(py_retdict, py_envname, py_envval) < 0)
goto error;
- Py_DECREF(py_envname);
- Py_DECREF(py_envval);
+ Py_CLEAR(py_envname);
+ Py_CLEAR(py_envval);
}
psutil_free_cstrings_array(env, env_count);
@@ -655,10 +655,10 @@ psutil_users(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_username);
- Py_DECREF(py_tty);
- Py_DECREF(py_hostname);
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_username);
+ Py_CLEAR(py_tty);
+ Py_CLEAR(py_hostname);
+ Py_CLEAR(py_tuple);
}
endutxent();
@@ -714,9 +714,9 @@ psutil_disk_partitions(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_dev);
- Py_DECREF(py_mountp);
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_dev);
+ Py_CLEAR(py_mountp);
+ Py_CLEAR(py_tuple);
}
fclose(file);
return py_retlist;
@@ -767,8 +767,7 @@ psutil_per_cpu_times(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_cputime))
goto error;
- Py_DECREF(py_cputime);
- py_cputime = NULL;
+ Py_CLEAR(py_cputime);
}
}
@@ -824,7 +823,7 @@ psutil_disk_io_counters(PyObject *self, PyObject *args) {
if (PyDict_SetItemString(py_retdict, ksp->ks_name,
py_disk_info))
goto error;
- Py_DECREF(py_disk_info);
+ Py_CLEAR(py_disk_info);
}
}
ksp = ksp->ks_next;
@@ -959,8 +958,8 @@ psutil_proc_memory_maps(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_path);
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_path);
+ Py_CLEAR(py_tuple);
// increment pointer
p += 1;
@@ -1075,7 +1074,7 @@ psutil_net_io_counters(PyObject *self, PyObject *args) {
goto error;
if (PyDict_SetItemString(py_retdict, ksp->ks_name, py_ifc_info))
goto error;
- Py_DECREF(py_ifc_info);
+ Py_CLEAR(py_ifc_info);
goto next;
next:
@@ -1273,7 +1272,7 @@ psutil_net_connections(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_tuple);
}
}
#if defined(AF_INET6)
@@ -1287,7 +1286,7 @@ psutil_net_connections(PyObject *self, PyObject *args) {
#ifdef NEW_MIB_COMPLIANT
processed_pid = tp6.tcp6ConnCreationProcess;
#else
- processed_pid = 0;
+ processed_pid = 0;
#endif
if (pid != -1 && processed_pid != pid)
continue;
@@ -1316,14 +1315,14 @@ psutil_net_connections(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_tuple);
}
}
#endif
// UDPv4
else if (mibhdr.level == MIB2_UDP || mibhdr.level == MIB2_UDP_ENTRY) {
num_ent = mibhdr.len / sizeof(mib2_udpEntry_t);
- assert(num_ent * sizeof(mib2_udpEntry_t) == mibhdr.len);
+ assert(num_ent * sizeof(mib2_udpEntry_t) == mibhdr.len);
for (i = 0; i < num_ent; i++) {
memcpy(&ude, databuf.buf + i * sizeof ude, sizeof ude);
#ifdef NEW_MIB_COMPLIANT
@@ -1355,7 +1354,7 @@ psutil_net_connections(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_tuple);
}
}
#if defined(AF_INET6)
@@ -1388,7 +1387,7 @@ psutil_net_connections(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_tuple);
}
}
#endif
@@ -1561,7 +1560,7 @@ psutil_net_if_stats(PyObject* self, PyObject* args) {
goto error;
if (PyDict_SetItemString(py_retdict, ksp->ks_name, py_ifc_info))
goto error;
- Py_DECREF(py_ifc_info);
+ Py_CLEAR(py_ifc_info);
}
}
diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c
index beaba18..08b208d 100644
--- a/psutil/_psutil_windows.c
+++ b/psutil/_psutil_windows.c
@@ -221,7 +221,7 @@ psutil_pids(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_pid))
goto error;
- Py_DECREF(py_pid);
+ Py_CLEAR(py_pid);
}
// free C array allocated for PIDs
@@ -1003,7 +1003,7 @@ psutil_per_cpu_times(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_tuple);
}
free(sppi);
@@ -1156,7 +1156,7 @@ psutil_proc_threads(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_tuple);
CloseHandle(hThread);
}
@@ -1580,7 +1580,7 @@ psutil_net_connections(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_conn_tuple))
goto error;
- Py_DECREF(py_conn_tuple);
+ Py_CLEAR(py_conn_tuple);
}
free(table);
@@ -1667,7 +1667,7 @@ psutil_net_connections(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_conn_tuple))
goto error;
- Py_DECREF(py_conn_tuple);
+ Py_CLEAR(py_conn_tuple);
}
free(table);
@@ -1730,7 +1730,7 @@ psutil_net_connections(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_conn_tuple))
goto error;
- Py_DECREF(py_conn_tuple);
+ Py_CLEAR(py_conn_tuple);
}
free(table);
@@ -1793,7 +1793,7 @@ psutil_net_connections(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_conn_tuple))
goto error;
- Py_DECREF(py_conn_tuple);
+ Py_CLEAR(py_conn_tuple);
}
free(table);
@@ -2188,8 +2188,8 @@ psutil_net_io_counters(PyObject *self, PyObject *args) {
goto error;
if (PyDict_SetItem(py_retdict, py_nic_name, py_nic_info))
goto error;
- Py_XDECREF(py_nic_name);
- Py_XDECREF(py_nic_info);
+ Py_CLEAR(py_nic_name);
+ Py_CLEAR(py_nic_info);
free(pIfRow);
pCurrAddresses = pCurrAddresses->Next;
@@ -2304,7 +2304,7 @@ psutil_disk_io_counters(PyObject *self, PyObject *args) {
goto error;
if (PyDict_SetItemString(py_retdict, szDeviceDisplay, py_tuple))
goto error;
- Py_XDECREF(py_tuple);
+ Py_CLEAR(py_tuple);
next:
CloseHandle(hDevice);
@@ -2461,7 +2461,7 @@ psutil_disk_partitions(PyObject *self, PyObject *args) {
goto error;
}
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_tuple);
// Continue looking for more mount points
mp_flag = FindNextVolumeMountPoint(mp_h, mp_buf, MAX_PATH);
@@ -2486,7 +2486,7 @@ psutil_disk_partitions(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_tuple);
+ Py_CLEAR(py_tuple);
goto next;
next:
@@ -2610,9 +2610,9 @@ psutil_users(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_XDECREF(py_username);
- Py_XDECREF(py_address);
- Py_XDECREF(py_tuple);
+ Py_CLEAR(py_username);
+ Py_CLEAR(py_address);
+ Py_CLEAR(py_tuple);
}
WTSFreeMemory(sessions);
@@ -2838,8 +2838,8 @@ psutil_proc_memory_maps(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_tuple);
- Py_DECREF(py_str);
+ Py_CLEAR(py_tuple);
+ Py_CLEAR(py_str);
}
previousAllocationBase = (ULONGLONG)basicInfo.AllocationBase;
baseAddress = (PCHAR)baseAddress + basicInfo.RegionSize;
@@ -2889,8 +2889,8 @@ psutil_ppid_map(PyObject *self, PyObject *args) {
goto error;
if (PyDict_SetItem(py_retdict, py_pid, py_ppid))
goto error;
- Py_DECREF(py_pid);
- Py_DECREF(py_ppid);
+ Py_CLEAR(py_pid);
+ Py_CLEAR(py_ppid);
} while (Process32Next(handle, &pe));
}
@@ -2993,8 +2993,8 @@ psutil_net_if_addrs(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_tuple);
- Py_DECREF(py_mac_address);
+ Py_CLEAR(py_tuple);
+ Py_CLEAR(py_mac_address);
}
// find out the IP address associated with the NIC
@@ -3070,14 +3070,14 @@ psutil_net_if_addrs(PyObject *self, PyObject *args) {
goto error;
if (PyList_Append(py_retlist, py_tuple))
goto error;
- Py_DECREF(py_tuple);
- Py_DECREF(py_address);
- Py_DECREF(py_netmask);
+ Py_CLEAR(py_tuple);
+ Py_CLEAR(py_address);
+ Py_CLEAR(py_netmask);
pUnicast = pUnicast->Next;
}
}
- Py_DECREF(py_nic_name);
+ Py_CLEAR(py_nic_name);
pCurrAddresses = pCurrAddresses->Next;
}
@@ -3197,8 +3197,8 @@ psutil_net_if_stats(PyObject *self, PyObject *args) {
goto error;
if (PyDict_SetItem(py_retdict, py_nic_name, py_ifc_info))
goto error;
- Py_DECREF(py_nic_name);
- Py_DECREF(py_ifc_info);
+ Py_CLEAR(py_nic_name);
+ Py_CLEAR(py_ifc_info);
}
free(pIfTable);

View File

@ -1,45 +1,56 @@
Name: python-psutil %global srcname psutil
Version: 5.9.8 %global sum A process and system utilities module for Python
Release: 5%{?dist}
Summary: A process and system utilities module for Python
License: BSD-3-Clause # Filter Python modules from Provides
%global __provides_exclude_from ^(%{python2_sitearch}|%{python3_sitearch})/.*\\.so$
# Prepared for Python 2 removal
%bcond_with python2
# Possibility to disable tests
%bcond_with tests
Name: python-%{srcname}
Version: 5.6.4
Release: 4%{?dist}
Summary: %{sum}
License: BSD
URL: https://github.com/giampaolo/psutil URL: https://github.com/giampaolo/psutil
Source: %{url}/archive/release-%{version}/psutil-%{version}.tar.gz Source0: https://github.com/giampaolo/psutil/archive/release-%{version}.tar.gz#/%{srcname}-%{version}.tar.gz
#
# skip tests that fail in mock chroots # Fix CVE-2019-18874: double free because of refcount mishandling
# # Resolved upstream: https://github.com/giampaolo/psutil/commit/7d512c8e4442a896d56505be3e78f1156f443465
Patch: python-psutil-skip-tests-in-mock.patch # and https://github.com/giampaolo/psutil/commit/3a9bccfd2c6d2e6538298cd3892058b1204056e0
# Patch0: CVE-2019-18874.patch
# avoid: AssertionError: 885725913.3 != 885725913.3000001 within 7 places
# # Exclude i686 arch. Due to a modularity issue it's being added to the
Patch: https://github.com/giampaolo/psutil/pull/2372.patch # x86_64 compose of CRB, but we don't want to ship it at all.
# # See: https://projects.engineering.redhat.com/browse/RCM-72605
# Skip test_emulate_multi_cpu on aarch64 and ppc64le ExcludeArch: i686
# Failure reported upstream: https://github.com/giampaolo/psutil/issues/2373
#
Patch: python-psutil-skip-test_emulate_multi_cpu.patch
#
# Skip test_misc.TestCommonModule.test_debug
# Failure reported upstream: https://github.com/giampaolo/psutil/issues/2374
#
Patch: python-psutil-skip-test_debug.patch
#
# Skip test_system.TestSensorsAPIs.test_sensors_temperatures
# Failure reported upstream: https://github.com/giampaolo/psutil/issues/2434
#
Patch: python-psutil-skip-test-sensors-temperatures.patch
#
# Don't treat sockets as paths
# Reported upstream: https://github.com/giampaolo/psutil/pull/2435
#
Patch: python-psutil-sockets-are-not-paths.patch
BuildRequires: gcc BuildRequires: gcc
BuildRequires: sed
BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-rpm-macros
# Test dependencies # Test dependencies
%if %{with tests}
BuildRequires: procps-ng BuildRequires: procps-ng
BuildRequires: python%{python3_pkgversion}-mock
%endif
%if %{with python2}
%if 0%{?fedora} < 32
BuildRequires: python2-mock
BuildRequires: python2-devel
BuildRequires: python2-ipaddress
%else
# This package has an exception to use Python 2 in Fedora 32+
# The exception is for chromium (chrome-remote-desktop)
# https://pagure.io/fesco/issue/2214
BuildRequires: python27
BuildRequires: python2-setuptools
%endif
%endif
%description %description
psutil is a module providing an interface for retrieving information on all psutil is a module providing an interface for retrieving information on all
@ -49,8 +60,23 @@ command line tools such as: ps, top, df, kill, free, lsof, free, netstat,
ifconfig, nice, ionice, iostat, iotop, uptime, pidof, tty, who, taskset, pmap. ifconfig, nice, ionice, iostat, iotop, uptime, pidof, tty, who, taskset, pmap.
%if %{with python2}
%package -n python2-%{srcname}
Summary: %{sum}
%{?python_provide:%python_provide python2-%{srcname}}
Obsoletes: python-%{srcname} < 3.1.1-3
%description -n python2-psutil
psutil is a module providing an interface for retrieving information on all
running processes and system utilization (CPU, memory, disks, network, users) in
a portable way by using Python 3, implementing many functionalities offered by
command line tools such as: ps, top, df, kill, free, lsof, free, netstat,
ifconfig, nice, ionice, iostat, iotop, uptime, pidof, tty, who, taskset, pmap.
%endif
%package -n python%{python3_pkgversion}-psutil %package -n python%{python3_pkgversion}-psutil
Summary: %{summary} Summary: %{sum}
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
%description -n python%{python3_pkgversion}-psutil %description -n python%{python3_pkgversion}-psutil
psutil is a module providing an interface for retrieving information on all psutil is a module providing an interface for retrieving information on all
@ -60,16 +86,8 @@ command line tools such as: ps, top, df, kill, free, lsof, free, netstat,
ifconfig, nice, ionice, iostat, iotop, uptime, pidof, tty, who, taskset, pmap. ifconfig, nice, ionice, iostat, iotop, uptime, pidof, tty, who, taskset, pmap.
%package -n python%{python3_pkgversion}-psutil-tests
Summary: %{summary}, test suite
Requires: python%{python3_pkgversion}-psutil%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%description -n python%{python3_pkgversion}-psutil-tests
The test suite for psutil.
%prep %prep
%autosetup -p1 -n psutil-release-%{version} %autosetup -p1 -n %{srcname}-release-%{version}
# Remove shebangs # Remove shebangs
find psutil -name \*.py | while read file; do find psutil -name \*.py | while read file; do
@ -78,167 +96,61 @@ find psutil -name \*.py | while read file; do
rm $file.orig rm $file.orig
done done
# When running tests on Zuul CI, "/" is not mounted, hence the test fail
# We want to run it on other build systems, hence the explicit skip for
# the particular buildhost
%if "%{_buildhost}" == "zuulci-mockbuild.redhat.com"
sed -i "s/test_disk_partitions/notest_disk_partitions/" psutil/tests/test_system.py
%endif
%generate_buildrequires
%pyproject_buildrequires
%build %build
%pyproject_wheel %if %{with python2}
%py2_build
%endif
%py3_build
%install %install
%pyproject_install %if %{with python2}
%pyproject_save_files psutil %py2_install
%endif
%py3_install
# Ignore tests when building with flatpak-module-tools to avoid build failures
# when building inside VMs or containers. Flatpaks would usually build this package
# as dependency from stable and already tested branches.
%if ! 0%{?flatpak}
%check %check
# Setting APPVEYOR to convince the test suite this is a CI. %if %{with tests}
# That way, some unreliable tests are skipped and some timeouts are extended. %if %{with python2} && 0%{?fedora} < 32
# Previously, this was done by the CI_TESTING variable, but that works no more. make test-memleaks PYTHON=%{__python2}
# Alternative is to set GITHUB_ACTIONS but that has undesirable side effects. %endif
make test-memleaks PYTHON=%{__python3}
# Note: We deliberately bypass the Makefile here to test the installed modules.
APPVEYOR=1 %{py3_test_envvars} %{python3} psutil/tests/runner.py
%endif %endif
%files -n python%{python3_pkgversion}-psutil -f %{pyproject_files} %if %{with python2}
%files -n python2-%{srcname}
%license LICENSE
%doc CREDITS HISTORY.rst README.rst %doc CREDITS HISTORY.rst README.rst
%exclude %{python3_sitearch}/psutil/tests %{python2_sitearch}/%{srcname}/
%{python2_sitearch}/*.egg-info
%endif
%files -n python%{python3_pkgversion}-psutil-tests
%{python3_sitearch}/psutil/tests/ %files -n python%{python3_pkgversion}-%{srcname}
%license LICENSE
%doc CREDITS HISTORY.rst README.rst
%{python3_sitearch}/%{srcname}/
%{python3_sitearch}/*.egg-info
%changelog %changelog
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 5.9.8-5 * Mon Jul 26 2021 Charalampos Stratakis <cstratak@redhat.com> - 5.6.4-4
- Bump release for October 2024 mass rebuild: - Security fix for CVE-2019-18874: double free because of refcount mishandling
Resolves: RHEL-64018 Resolves: rhbz#1772014
* Tue Aug 20 2024 Karolina Surma <ksurma@redhat.com> - 5.9.8-4 * Thu Dec 12 2019 Tomas Orsava <torsava@redhat.com> - 5.6.4-3
- Skip unreliable test_sensors_temperatures - Exclude unsupported i686 arch
- Don't treat sockets as paths in tests
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 5.9.8-3 * Wed Nov 20 2019 Lumír Balhar <lbalhar@redhat.com> - 5.6.4-2
- Bump release for June 2024 mass rebuild - Adjusted for Python 3.8 module in RHEL 8
* Wed Feb 14 2024 Stephen Gallagher <sgallagh@redhat.com> - 5.9.8-2 * Wed Nov 06 2019 Lumír Balhar <lbalhar@redhat.com> - 5.6.4-1
- Skip unreliable multi-cpu test on ppc64le - New upstream release 5.6.4
- bcond for Python 2 subpackage and tests
* Fri Feb 09 2024 Miro Hrončok <mhroncok@redhat.com> - 5.9.8-1 - Enabled tests
- 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
* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.9.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Tue Aug 08 2023 Karolina Surma <ksurma@redhat.com> - 5.9.5-2
- Declare the license as an SPDX expression
* Fri Aug 04 2023 Jonathan Wright <jonathan@almalinux.org> - 5.9.5-1
- Update to 5.9.5 rhbz#2135931
- Skip unreliable test rhbz#2169395
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 5.9.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 5.9.2-3
- Rebuilt for Python 3.12
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 5.9.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Sun Sep 18 2022 Kevin Fenzi <kevin@scrye.com> - 5.9.2-1
- Update to 5.9.2. Fixes rhbz#2124116
* Sun Jul 31 2022 Jonathan Wright <jonathan@almalinux.org> - 5.9.1-1
- Update to 5.9.1. Fixes rhbz#2036137
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 5.8.0-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 5.8.0-15
- Rebuilt for Python 3.11
* Thu Jun 09 2022 Miro Hrončok <mhroncok@redhat.com> - 5.8.0-14
- Relax testing assumptions when building the package
- Fixes: rhbz#2049426
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 5.8.0-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Wed Sep 08 2021 Miro Hrončok <mhroncok@redhat.com> - 5.8.0-12
- Drop python2-psutil, as it is no longer needed
* Wed Aug 18 2021 Charalampos Stratakis <cstratak@redhat.com> - 5.8.0-11
- Separate the tests to their own subpackage
* Sat Aug 07 2021 Kevin Fenzi <kevin@scrye.com> - 5.8.0-10
- Add patch to add delta for cpu tests.
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 5.8.0-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Wed Jun 23 2021 Miro Hrončok <mhroncok@redhat.com> - 5.8.0-8
- Drop optional build dependency on python2-setuptools
* Wed Jun 02 2021 Python Maint <python-maint@redhat.com> - 5.8.0-7
- Rebuilt for Python 3.10
* Thu Apr 15 2021 Miro Hrončok <mhroncok@redhat.com> - 5.8.0-6
- Add tolerance to a flaky test
* Thu Jan 28 2021 Tomas Orsava <torsava@redhat.com> - 5.8.0-5
- Remove unnecessary test dependency on python3-mock
- Remove unnecessary macro __provides_exclude_from
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 5.8.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Sun Jan 10 2021 Kevin Fenzi <kevin@scrye.com> - 5.8.0-3
- Disable test_leak_mem test.
* Sun Jan 10 2021 Kevin Fenzi <kevin@scrye.com> - 5.8.0-2
- Disable test_sensors_temperatures test.
* Fri Jan 01 2021 Kevin Fenzi <kevin@scrye.com> - 5.8.0-1
- Update to 5.8.0. Fixes rhbz#1909321
- Re-enable tests (skipping 2 that fail in mock).
* Fri Nov 06 2020 Joel Capitao <jcapitao@redhat.com> - 5.7.3-1
- Update to 5.7.3 (rhbz#1857187)
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 5.7.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Jul 22 2020 Nicolas Chauvet <kwizart@gmail.com> - 5.7.2-1
- Update to 5.7.2
* Wed Jun 24 2020 Michel Alexandre Salim <salimma@fedoraproject.org> - 5.6.7-3
- Add BR on setuptools for all package combinations
* Sat May 23 2020 Miro Hrončok <mhroncok@redhat.com> - 5.6.7-2
- Rebuilt for Python 3.9
* Sun Feb 16 2020 Kevin Fenzi <kevin@scrye.com> - 5.6.7-1
- Update to 5.6.7. Fixes bug 1768362.
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 5.6.3-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Sun Oct 06 2019 Kevin Fenzi <kevin@scrye.com> - 5.6.3-5 * Sun Oct 06 2019 Kevin Fenzi <kevin@scrye.com> - 5.6.3-5
- Add python2-setuptools to BuildRequires to fix egg info. Fixes bug #1750362 - Add python2-setuptools to BuildRequires to fix egg info. Fixes bug #1750362

View File

@ -1,5 +0,0 @@
--- !Policy
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

View File

@ -1,4 +0,0 @@
discover:
how: fmf
execute:
how: tmt

View File

@ -1,13 +0,0 @@
diff --git a/psutil/tests/test_system.py b/psutil/tests/test_system.py
index c146f3e..671babc 100755
--- a/psutil/tests/test_system.py
+++ b/psutil/tests/test_system.py
@@ -903,7 +903,7 @@ class TestNetAPIs(PsutilTestCase):
class TestSensorsAPIs(PsutilTestCase):
- @unittest.skipIf(not HAS_SENSORS_TEMPERATURES, "not supported")
+ @unittest.skip("https://github.com/giampaolo/psutil/issues/2434")
def test_sensors_temperatures(self):
temps = psutil.sensors_temperatures()
for name, entries in temps.items():

View File

@ -1,12 +0,0 @@
diff --git a/psutil/tests/test_misc.py b/psutil/tests/test_misc.py
index 700c054..d0b675e 100755
--- a/psutil/tests/test_misc.py
+++ b/psutil/tests/test_misc.py
@@ -569,6 +569,7 @@ class TestCommonModule(PsutilTestCase):
with mock.patch('psutil._common.stat.S_ISREG', return_value=False):
assert not isfile_strict(this_file)
+ @unittest.skip("https://github.com/giampaolo/psutil/issues/2374")
def test_debug(self):
if PY3:
from io import StringIO

View File

@ -1,36 +0,0 @@
From 35d3054307a6f2e607026101e6f0b19b6c472864 Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgallagh@redhat.com>
Date: Wed, 14 Feb 2024 18:14:08 -0500
Subject: [PATCH] Skip on aarch64 and ppc64le
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
---
psutil/tests/test_linux.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py
index 0583e619de59931a9ee80411a95ef8eb7ef6c171..7f6cfd5431086b108c1a7fa140b407cc9b6b0836 100755
--- a/psutil/tests/test_linux.py
+++ b/psutil/tests/test_linux.py
@@ -14,6 +14,7 @@ import errno
import glob
import io
import os
+import platform
import re
import shutil
import socket
@@ -888,6 +889,10 @@ class TestSystemCPUFrequency(PsutilTestCase):
self.assertEqual(freq.max, 700.0)
@unittest.skipIf(not HAS_CPU_FREQ, "not supported")
+ @unittest.skipIf(platform.machine() == "aarch64",
+ "https://github.com/giampaolo/psutil/issues/2373")
+ @unittest.skipIf(platform.machine() == "ppc64le",
+ "https://github.com/giampaolo/psutil/issues/2373")
def test_emulate_multi_cpu(self):
def open_mock(name, *args, **kwargs):
n = name
--
2.43.0

View File

@ -1,166 +0,0 @@
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)
- @retry_on_failure()
+ @unittest.skip("Unreliable on mock")
def test_used(self):
# Older versions of procps used slab memory to calculate used memory.
# This got changed in:
@@ -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:
@@ -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.skip("Unreliable on mock")
def test_against_sysdev_cpu_online(self):
with open("/sys/devices/system/cpu/online") as f:
value = f.read().strip()
@@ -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 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])
self.assertEqual(psutil.cpu_count(), count)
- @unittest.skipIf(not which("nproc"), "nproc utility not available")
+ @unittest.skip("Unreliable on mock")
def test_against_nproc(self):
num = int(sh("nproc --all"))
self.assertEqual(psutil.cpu_count(logical=True), num)
@@ -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")
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):
@@ -830,7 +825,7 @@ class TestSystemCPUFrequency(PsutilTestCase):
):
assert psutil.cpu_freq()
- @unittest.skipIf(not HAS_CPU_FREQ, "not supported")
+ @unittest.skip("Unreliable on mock")
def test_emulate_use_cpuinfo(self):
# Emulate a case where /sys/devices/system/cpu/cpufreq* does not
# exist and /proc/cpuinfo is used instead.
@@ -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):
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):
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()
- @unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
+ @unittest.skip("Unreliable on mock")
def test_comparisons(self):
finder = RootFsDeviceFinder()
self.assertIsNotNone(finder.find())
@@ -1428,11 +1423,13 @@ class TestRootFsDeviceFinder(PsutilTestCase):
@unittest.skipIf(not which("findmnt"), "findmnt utility not available")
@unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
+ @unittest.skip("Unreliable on mock")
def test_against_findmnt(self):
psutil_value = RootFsDeviceFinder().find()
findmnt_value = sh("findmnt -o SOURCE -rn /")
self.assertEqual(psutil_value, findmnt_value)
+ @unittest.skip("Unreliable on mock")
def test_disk_partitions_mocked(self):
with mock.patch(
'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_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)
+ @unittest.skip("Unreliable on mock")
def test_cpu_affinity(self):
value = self.read_status_file("Cpus_allowed_list:")
if '-' in str(value):
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(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 --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()
- @unittest.skipIf(CI_TESTING, "skipped on CI")
+ @unittest.skip("Unreliable in mock")
@unittest.skipIf(COVERAGE, "skipped during test coverage")
def test_leak_mem(self):
ls = []

View File

@ -1,13 +0,0 @@
diff --git a/psutil/tests/test_process_all.py b/psutil/tests/test_process_all.py
index afb3195..fd9c96c 100755
--- a/psutil/tests/test_process_all.py
+++ b/psutil/tests/test_process_all.py
@@ -404,7 +404,7 @@ class TestFetchAllProcesses(PsutilTestCase):
for fname in nt._fields:
value = getattr(nt, fname)
if fname == 'path':
- if not value.startswith(("[", "anon_inode:")):
+ if not value.startswith(("[", "anon_inode:", "socket:")):
assert os.path.isabs(nt.path), nt.path
# commented as on Linux we might get
# '/foo/bar (deleted)'

View File

@ -1 +0,0 @@
SHA512 (psutil-5.9.8.tar.gz) = 9943adcf4cdb333c729765fef9e3cc7623ef90cfdf8c91fcb8093c45a6978efa9f749b1f1818dde99a772b89e9dd86c3d7cc5f8f1047bf8782d00a30d9284c7f

View File

@ -1,13 +0,0 @@
framework: shell
require:
- make
- gcc
- procps-ng
- python3-psutil
- python3-psutil-tests
- python3-devel
- python3-setuptools
- sed
test: |
python3 -m psutil.tests
tty: true