Sync from SUSE:SLFO:Main python-psutil revision 323749a1b36a7cb4c2ca18477ec41056

This commit is contained in:
Adrian Schröter 2024-12-13 11:58:45 +01:00
parent e80c33b897
commit c085fffdc8
7 changed files with 256 additions and 413 deletions

View File

@ -1,233 +0,0 @@
From 89b2d1896ffa8e5c9a8d9b89c3af0bb9027ce23b Mon Sep 17 00:00:00 2001
From: Alberto Planas <aplanas@suse.com>
Date: Tue, 22 Aug 2023 15:54:09 +0200
Subject: [PATCH] Use logind instead of utmp because of Y2038
Bi-arch systems line x86-64 present the Y2038 problem, where an overflow
can be produced because some glibc compatibility decissions (see
https://github.com/thkukuk/utmpx/blob/main/Y2038.md for more
information)
This patch uses logind from systemd instead of utmp on Linux systems, if
the systemd version is support the new API (>= 254).
Signed-off-by: Alberto Planas <aplanas@suse.com>
---
INSTALL.rst | 4 +--
psutil/_psutil_linux.c | 81 ++++++++++++++++++++++++++++++++++++++++--
setup.py | 22 ++++++++++++
3 files changed, 102 insertions(+), 5 deletions(-)
Index: psutil-5.9.5/INSTALL.rst
===================================================================
--- psutil-5.9.5.orig/INSTALL.rst
+++ psutil-5.9.5/INSTALL.rst
@@ -17,12 +17,12 @@ Linux (build)
Ubuntu / Debian::
- sudo apt-get install gcc python3-dev
+ sudo apt-get install gcc python3-dev libsystemd-dev
pip install --no-binary :all: psutil
RedHat / CentOS::
- sudo yum install gcc python3-devel
+ sudo yum install gcc python3-devel systemd-devel
pip install --no-binary :all: psutil
Alpine::
Index: psutil-5.9.5/psutil/_psutil_linux.c
===================================================================
--- psutil-5.9.5.orig/psutil/_psutil_linux.c
+++ psutil-5.9.5/psutil/_psutil_linux.c
@@ -14,7 +14,11 @@
#include <stdlib.h>
#include <mntent.h>
#include <features.h>
-#include <utmp.h>
+#ifdef SYSTEMD_LINUX
+ #include <systemd/sd-login.h>
+#else
+ #include <utmp.h>
+#endif
#include <sched.h>
#include <linux/version.h>
#include <sys/syscall.h>
@@ -363,42 +367,102 @@ psutil_proc_cpu_affinity_set(PyObject *s
*/
static PyObject *
psutil_users(PyObject *self, PyObject *args) {
+#ifdef SYSTEMD_LINUX
+ char **sessions_list = NULL;
+#else
struct utmp *ut;
+#endif
PyObject *py_retlist = PyList_New(0);
PyObject *py_tuple = NULL;
PyObject *py_username = NULL;
PyObject *py_tty = NULL;
PyObject *py_hostname = NULL;
PyObject *py_user_proc = NULL;
+ double tstamp = 0.0;
+ pid_t pid = 0;
if (py_retlist == NULL)
return NULL;
+#ifdef SYSTEMD_LINUX
+ int sessions = sd_get_sessions(&sessions_list);
+ for (int i = 0; i < sessions; i++) {
+ const char *session_id = sessions_list[i];
+#else
setutent();
while (NULL != (ut = getutent())) {
+#endif
py_tuple = NULL;
py_user_proc = NULL;
+ #ifdef SYSTEMD_LINUX
+ py_user_proc = Py_True;
+ #else
if (ut->ut_type == USER_PROCESS)
py_user_proc = Py_True;
else
py_user_proc = Py_False;
+ #endif
+
+ #ifdef SYSTEMD_LINUX
+ char *username = NULL;
+ if (sd_session_get_username(session_id, &username) < 0)
+ goto error;
+ py_username = PyUnicode_DecodeFSDefault(username);
+ free(username);
+ #else
py_username = PyUnicode_DecodeFSDefault(ut->ut_user);
+ #endif
if (! py_username)
goto error;
+
+ #ifdef SYSTEMD_LINUX
+ char *tty = NULL;
+ if (sd_session_get_tty(session_id, &tty) < 0) {
+ py_tty = PyUnicode_DecodeFSDefault("n/a");
+ } else {
+ py_tty = PyUnicode_DecodeFSDefault(tty);
+ free(tty);
+ }
+ #else
py_tty = PyUnicode_DecodeFSDefault(ut->ut_line);
+ #endif
if (! py_tty)
goto error;
+ #ifdef SYSTEMD_LINUX
+ char *hostname = NULL;
+ if (sd_session_get_remote_host(session_id, &hostname) < 0)
+ goto error;
+ py_hostname = PyUnicode_DecodeFSDefault(hostname);
+ free(hostname);
+ #else
py_hostname = PyUnicode_DecodeFSDefault(ut->ut_host);
+ #endif
if (! py_hostname)
goto error;
+ #ifdef SYSTEMD_LINUX
+ uint64_t usec = 0;
+ if (sd_session_get_start_time(session_id, &usec) < 0)
+ goto error;
+ tstamp = (double)usec / 1000000.0;
+ #else
+ tstamp = (double)ut->ut_tv.tv_sec;
+ #endif
+
+ #ifdef SYSTEMD_LINUX
+ if (sd_session_get_leader(session_id, &pid) < 0)
+ goto error;
+ #else
+ pid = ut->ut_pid;
+ #endif
+
py_tuple = Py_BuildValue(
"OOOdO" _Py_PARSE_PID,
py_username, // username
py_tty, // tty
py_hostname, // hostname
- (double)ut->ut_tv.tv_sec, // tstamp
+ tstamp, // tstamp
py_user_proc, // (bool) user process
- ut->ut_pid // process id
+ pid // process id
);
if (! py_tuple)
goto error;
@@ -408,8 +472,15 @@ psutil_users(PyObject *self, PyObject *a
Py_CLEAR(py_tty);
Py_CLEAR(py_hostname);
Py_CLEAR(py_tuple);
+ #ifdef SYSTEMD_LINUX
+ free (sessions_list[i]);
+ #endif
}
+#ifdef SYSTEMD_LINUX
+ free(sessions_list);
+#else
endutent();
+#endif
return py_retlist;
error:
@@ -418,7 +489,11 @@ error:
Py_XDECREF(py_hostname);
Py_XDECREF(py_tuple);
Py_DECREF(py_retlist);
+#ifdef SYSTEMD_LINUX
+ free(sessions_list);
+#else
endutent();
+#endif
return NULL;
}
Index: psutil-5.9.5/setup.py
===================================================================
--- psutil-5.9.5.orig/setup.py
+++ psutil-5.9.5/setup.py
@@ -184,6 +184,20 @@ def unix_can_compile(c_code):
shutil.rmtree(tempdir)
+def get_systemd_version():
+ r = subprocess.run(["systemctl", "--version"], capture_output=True)
+ if r.returncode != 0:
+ return 0
+ out = r.stdout.split()
+ if len(out) < 2:
+ return 0
+ version = out[1]
+ try:
+ return int(version)
+ except ValueError:
+ return 0
+
+
if WINDOWS:
def get_winver():
maj, min = sys.getwindowsversion()[0:2]
@@ -302,10 +316,18 @@ elif LINUX:
if not unix_can_compile("#include <linux/ethtool.h>"):
macros.append(("PSUTIL_ETHTOOL_MISSING_TYPES", 1))
+ libraries = []
+ # Systemd >= 254 can replace utmp. See:
+ # https://github.com/thkukuk/utmpx/blob/main/utmp-to-logind.md
+ if get_systemd_version() >= 254:
+ macros.append(("SYSTEMD_LINUX", 1))
+ libraries.append("systemd")
+
macros.append(("PSUTIL_LINUX", 1))
ext = Extension(
'psutil._psutil_linux',
sources=sources + ['psutil/_psutil_linux.c'],
+ libraries=libraries,
define_macros=macros,
**py_limited_api)

BIN
psutil-5.9.5.tar.gz (Stored with Git LFS)

Binary file not shown.

BIN
psutil-6.0.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -1,3 +1,129 @@
-------------------------------------------------------------------
Wed Jul 17 12:33:03 UTC 2024 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
- Update to version 6.0.0
* 2109_: ``maxfile`` and ``maxpath`` fields were removed from the namedtuple
returned by `disk_partitions()`_. Reason: on network filesystems (NFS) this
can potentially take a very long time to complete.
* 2366_, [Windows]: log debug message when using slower process APIs.
* 2375_, [macOS]: provide arm64 wheels. (patch by Matthieu Darbois)
* 2396_: `process_iter()`_ no longer pre-emptively checks whether PIDs have
been reused. This makes `process_iter()`_ around 20x times faster.
* 2396_: a new ``psutil.process_iter.cache_clear()`` API can be used the clear
`process_iter()`_ internal cache.
* 2401_, Support building with free-threaded CPython 3.13. (patch by Sam Gross)
* 2407_: `Process.connections()`_ was renamed to `Process.net_connections()`_.
The old name is still available, but it's deprecated (triggers a
``DeprecationWarning``) and will be removed in the future.
* 2425_: [Linux]: provide aarch64 wheels. (patch by Matthieu Darbois / Ben Raz)
* 2250_, [NetBSD]: `Process.cmdline()`_ sometimes fail with EBUSY. It usually
happens for long cmdlines with lots of arguments. In this case retry getting
the cmdline for up to 50 times, and return an empty list as last resort.
* 2254_, [Linux]: offline cpus raise NotImplementedError in cpu_freq() (patch
by Shade Gladden)
* 2272_: Add pickle support to psutil Exceptions.
* 2359_, [Windows], [CRITICAL]: `pid_exists()`_ disagrees with `Process`_ on
whether a pid exists when ERROR_ACCESS_DENIED.
* 2360_, [macOS]: can't compile on macOS < 10.13. (patch by Ryan Schmidt)
* 2362_, [macOS]: can't compile on macOS 10.11. (patch by Ryan Schmidt)
* 2365_, [macOS]: can't compile on macOS < 10.9. (patch by Ryan Schmidt)
* 2395_, [OpenBSD]: `pid_exists()`_ erroneously return True if the argument is
a thread ID (TID) instead of a PID (process ID).
* 2412_, [macOS]: can't compile on macOS 10.4 PowerPC due to missing `MNT_`
constants.
* 2109_: the namedtuple returned by `disk_partitions()`_' no longer has
``maxfile`` and ``maxpath`` fields.
* 2396_: `process_iter()`_ no longer pre-emptively checks whether PIDs have
been reused. If you want to check for PID reusage you are supposed to use
`Process.is_running()`_ against the yielded `Process`_ instances. That will
also automatically remove reused PIDs from `process_iter()`_ internal cache.
* 2407_: `Process.connections()`_ was renamed to `Process.net_connections()`_.
The old name is still available, but it's deprecated (triggers a
``DeprecationWarning``) and will be removed in the future.
- from version 5.9.8
* 2343_, [FreeBSD]: filter `net_connections()`_ returned list in C instead of
Python, and avoid to retrieve unnecessary connection types unless explicitly
asked. E.g., on an IDLE system with few IPv6 connections this will run around
4 times faster. Before all connection types (TCP, UDP, UNIX) were retrieved
internally, even if only a portion was returned.
* 2342_, [NetBSD]: same as above (#2343) but for NetBSD.
* 2349_: adopted black formatting style.
* 930_, [NetBSD], [critical]: `net_connections()`_ implementation was broken.
It could either leak memory or core dump.
* 2340_, [NetBSD]: if process is terminated, `Process.cwd()`_ will return an
empty string instead of raising `NoSuchProcess`_.
* 2345_, [Linux]: fix compilation on older compiler missing DUPLEX_UNKNOWN.
* 2222_, [macOS]: `cpu_freq()` now returns fixed values for `min` and `max`
frequencies in all Apple Silicon chips.
- Drop obsolete patch to skip tests on Python 2
* skip_rlimit_tests_on_python2.patch
- Update patch to skip failing tests for new version
* skip_failing_tests.patch
-------------------------------------------------------------------
Fri Mar 22 10:40:19 UTC 2024 - Fabian Vogt <fvogt@suse.com>
- BuildRequire pkgconfig(libsystemd) instead of full systemd
-------------------------------------------------------------------
Wed Dec 27 13:53:57 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 5.9.7:
* 2324_: enforce Ruff rule `raw-string-in-exception`, which
helps providing clearer tracebacks when exceptions are
raised by psutil.
* 2325_, [PyPy]: psutil did not compile on PyPy due to missing
`PyErr_SetExcFromWindowsErrWithFilenameObject` cPython API.
- drop logind_y2038.patch (upstream)
-------------------------------------------------------------------
Wed Nov 15 20:38:35 UTC 2023 - Benoît Monin <benoit.monin@gmx.fr>
- update to version 5.9.6:
* Enhancements
+ 1703: cpu_percent() and cpu_times_percent() are now thread
safe, meaning they can be called from different threads and
still return meaningful and independent results.
+ 2266: if Process class is passed a very high PID, raise
NoSuchProcess instead of OverflowError. (patch by Xuehai Pan)
+ 2246: drop python 3.4 & 3.5 support. (patch by Matthieu
Darbois)
+ 2290: PID reuse is now pre-emptively checked for
Process.ppid() and Process.parents().
+ 2312: use ruff Python linter instead of flake8 + isort. It's
an order of magnitude faster + it adds a ton of new code
quality checks.
* Bug fixes
+ 2195, [Linux]: no longer print exception at import time in
case /proc/stat can't be read due to permission error.
+ 2268: bytes2human() utility function was unable to properly
represent negative values.
+ 2284, [Linux]: Process.memory_full_info() may incorrectly
raise ZombieProcess if it's determined via
/proc/pid/smaps_rollup.
+ 2288, [Linux]: correctly raise ZombieProcess on
Process.exe(), Process.cmdline() and Process.memory_maps()
instead of returning a "null" value.
+ 2290: differently from what stated in the doc, PID reuse is
not pre-emptively checked for Process.nice() (set),
Process.ionice(), (set), Process.cpu_affinity() (set),
Process.rlimit() (set), Process.parent().
- refresh skip_rlimit_tests_on_python2.patch
- drop removal of shebang: fixed upstream
-------------------------------------------------------------------
Tue Oct 24 14:59:47 UTC 2023 - Alberto Planas Dominguez <aplanas@suse.com>
- Rebase logind_y2038.patch based on the reviewed code
-------------------------------------------------------------------
Sat Sep 30 19:15:18 UTC 2023 - Ben Greiner <code@bnavigator.de>
- Require /usr/bin/who only for suse_version > 1500: 15.X does not
provide it, but has it in coreutils.
- PEP517
- Clean up specfile from obsolete python2 stuff
-------------------------------------------------------------------
Wed Sep 6 11:23:59 UTC 2023 - Dominique Leuenberger <dimstar@opensuse.org>
@ -22,7 +148,7 @@ Wed May 3 09:04:54 UTC 2023 - Dirk Müller <dmueller@suse.com>
or `UserWarning` is raised.
* there are cases where `Process.cwd()`_ cannot be
determined (e.g. directory no longer exists), in which case
we returned either ``None`` or an empty string.
we returned either ``None`` or an empty string.
This was consolidated and we now return ``""`` on all
platforms.
* [UNIX]: if process is a zombie, and we can only
@ -982,7 +1108,7 @@ Tue Nov 8 21:15:33 UTC 2016 - toddrme2178@gmail.com
fail without raising an exception.
+ 933: [Windows] memory leak in cpu_stats() and
WindowsService.description().
-------------------------------------------------------------------
Sat Nov 5 16:22:59 UTC 2016 - michael@stroeder.com
@ -996,18 +1122,18 @@ Tue Oct 25 18:13:08 UTC 2016 - michael@stroeder.com
* 927: Popen.__del__() may cause maximum recursion depth error.
- Update to version 4.4.0:
Enhancements
* 887: [Linux] virtual_memory()'s 'available' and 'used'
values are more precise and match "free" cmdline utility.
"available" also takes into account LCX containers
* 887: [Linux] virtual_memory()'s 'available' and 'used'
values are more precise and match "free" cmdline utility.
"available" also takes into account LCX containers
preventing "available" to overflow "total".
* 891: procinfo.py script has been updated and provides a
* 891: procinfo.py script has been updated and provides a
lot more info.
Bug fixes
* 825: [Linux] cpu_affinity; fix possible double close and
* 825: [Linux] cpu_affinity; fix possible double close and
use of unopened socket.
* 885: ValueError is raised if a negative integer is passed
* 885: ValueError is raised if a negative integer is passed
to cpu_percent() functions.
* 892: [Linux] Process.cpu_affinity([-1]) raise SystemError
* 892: [Linux] Process.cpu_affinity([-1]) raise SystemError
with no error set; now ValueError is raised.
-------------------------------------------------------------------
@ -1016,15 +1142,15 @@ Sat Sep 24 12:36:35 UTC 2016 - michael@stroeder.com
- update to version 4.3.1:
* #881: "make install" now works also when using a virtual env.
* #854: Process.as_dict() raises ValueError if passed an erroneous attrs name.
* #857: [SunOS] Process cpu_times(), cpu_percent(), threads() amd
memory_maps() may raise RuntimeError if attempting to query a 64bit
* #857: [SunOS] Process cpu_times(), cpu_percent(), threads() amd
memory_maps() may raise RuntimeError if attempting to query a 64bit
process with a 32bit python. "Null" values are returned as a fallback.
* #858: Process.as_dict() should not return memory_info_ex() because it's
* #858: Process.as_dict() should not return memory_info_ex() because it's
deprecated.
* #863: [Windows] memory_map truncates addresses above 32 bits
* #866: [Windows] win_service_iter() and services in general are not able
* #866: [Windows] win_service_iter() and services in general are not able
to handle unicode service names / descriptions.
* #869: [Windows] Process.wait() may raise TimeoutExpired with wrong
* #869: [Windows] Process.wait() may raise TimeoutExpired with wrong
timeout unit (ms instead of sec).
* #870: [Windows] Handle leak inside psutil_get_process_data.
@ -1323,7 +1449,7 @@ Mon Feb 2 22:16:07 UTC 2015 - michael@stroeder.com
- Update to 2.2.1:
- Fixed #572
ValueError: ambiguos inode with multiple PIDs references
ValueError: ambiguos inode with multiple PIDs references
-------------------------------------------------------------------
Tue Jan 6 23:46:40 UTC 2015 - michael@stroeder.com
@ -1532,7 +1658,7 @@ Sat Oct 6 23:01:56 UTC 2012 - os-dev@jacraig.com
Fri May 25 04:29:28 UTC 2012 - highwaystar.ru@gmail.com
- python3 package added
- minor spec improvement
- minor spec improvement
-------------------------------------------------------------------
Tue Apr 24 07:44:19 UTC 2012 - saschpe@suse.de
@ -1549,5 +1675,5 @@ Fri Mar 23 09:44:42 UTC 2012 - saschpe@suse.de
-------------------------------------------------------------------
Mon Mar 19 22:00:43 UTC 2012 - cfarrell@suse.com
- First import
- First import

View File

@ -1,7 +1,7 @@
#
# spec file for package python-psutil
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -16,16 +16,14 @@
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%ifarch x86_64 %{ix86}
%bcond_without test
%else
%bcond_with test
%endif
%bcond_without python2
%{?sle15_python_module_pythons}
Name: python-psutil
Version: 5.9.5
Version: 6.0.0
Release: 0
Summary: A process utilities module for Python
License: BSD-3-Clause
@ -34,31 +32,22 @@ Source: https://files.pythonhosted.org/packages/source/p/psutil/psutil-%
# 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
# PATCH-FIX-SLE adopt change of used memory of procps
Patch4: mem-used-bsc1181475.patch
# PATCH-FIX-UPSTREAM logind_y2038.patch gh#giampaolo/psutil#2300 aplanas@suse.com
Patch5: logind_y2038.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: procps
BuildRequires: systemd
BuildRequires: systemd-devel
BuildRequires: pkgconfig(libsystemd)
%if %{with test}
%if 0%{?suse_version} > 1500
BuildRequires: /usr/bin/who
%endif
BuildRequires: net-tools
BuildRequires: procps
%if %{with python2}
BuildRequires: python-ipaddress
BuildRequires: python-mock
BuildRequires: python-unittest2
%endif
%endif
%ifpython2
Requires: python-ipaddress
%endif
%python_subpackages
@ -66,17 +55,13 @@ Requires: python-ipaddress
A graphical interface that lets you easily analyze and introspect unaltered running Python processes.
%prep
%setup -q -n psutil-%{version}
%autopatch -p1
# Remove shebangs
sed -i "1s/#!.*//" psutil/{__init__.py,_compat.py,_psbsd.py,_pslinux.py,_psosx.py,_psposix.py,_pssunos.py,_pswindows.py}
%autosetup -p1 -n psutil-%{version}
%build
%python_build
%pyproject_wheel
%install
%python_install
%pyproject_install
%{python_expand mkdir -p %{buildroot}%{_docdir}/%{$python_prefix}-psutil
cp -r scripts %{buildroot}%{_docdir}/%{$python_prefix}-psutil/
@ -103,6 +88,6 @@ popd
%{_docdir}/%{python_prefix}-psutil/scripts/
%{python_sitearch}/psutil/
%exclude %{python_sitearch}/psutil/tests
%{python_sitearch}/psutil-%{version}*-info
%{python_sitearch}/psutil-%{version}.dist-info
%changelog

View File

@ -1,36 +1,18 @@
Index: psutil-5.9.5/psutil/tests/test_misc.py
===================================================================
--- psutil-5.9.5.orig/psutil/tests/test_misc.py
+++ psutil-5.9.5/psutil/tests/test_misc.py
@@ -251,6 +251,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):
@@ -847,6 +848,7 @@ class TestScripts(PsutilTestCase):
src = f.read()
ast.parse(src)
diff -Nru psutil-6.0.0.orig/psutil/tests/test_contracts.py psutil-6.0.0/psutil/tests/test_contracts.py
--- psutil-6.0.0.orig/psutil/tests/test_contracts.py 2024-06-18 22:36:40.000000000 +0200
+++ psutil-6.0.0/psutil/tests/test_contracts.py 2024-07-17 14:20:15.685789923 +0200
@@ -249,6 +249,7 @@
self.assertIsInstance(k, str)
self.assert_ntuple_of_nums(v, type_=(int, long))
+ @unittest.skip("Fails in OBS")
def test_coverage(self):
# make sure all example scripts have a test method defined
meths = dir(self)
@@ -866,6 +868,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.5/psutil/tests/test_linux.py
===================================================================
--- psutil-5.9.5.orig/psutil/tests/test_linux.py
+++ psutil-5.9.5/psutil/tests/test_linux.py
@@ -713,6 +713,7 @@ class TestSystemCPUCountLogical(PsutilTe
def test_disk_partitions(self):
# Duplicate of test_system.py. Keep it anyway.
for disk in psutil.disk_partitions():
diff -Nru psutil-6.0.0.orig/psutil/tests/test_linux.py psutil-6.0.0/psutil/tests/test_linux.py
--- psutil-6.0.0.orig/psutil/tests/test_linux.py 2024-06-18 23:00:36.000000000 +0200
+++ psutil-6.0.0/psutil/tests/test_linux.py 2024-07-17 14:20:15.685789923 +0200
@@ -756,6 +756,7 @@
self.assertEqual(psutil.cpu_count(logical=True), num)
@unittest.skipIf(not which("lscpu"), "lscpu utility not available")
@ -38,31 +20,31 @@ Index: psutil-5.9.5/psutil/tests/test_linux.py
def test_against_lscpu(self):
out = sh("lscpu -p")
num = len([x for x in out.split('\n') if not x.startswith('#')])
@@ -756,6 +757,7 @@ class TestSystemCPUCountLogical(PsutilTe
@@ -801,6 +802,7 @@
@unittest.skipIf(not LINUX, "LINUX only")
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()
@@ -1134,6 +1136,7 @@ class TestSystemDiskPartitions(PsutilTes
@@ -1196,6 +1198,7 @@
class TestSystemDiskPartitions(PsutilTestCase):
@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"
@@ -1308,6 +1311,7 @@ class TestSystemDiskIoCounters(PsutilTes
@@ -1374,6 +1377,7 @@
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':
@@ -1351,6 +1355,7 @@ class TestRootFsDeviceFinder(PsutilTestC
return path == '/proc/diskstats'
@@ -1417,6 +1421,7 @@
finder.ask_sys_class_block()
@unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
@ -70,15 +52,15 @@ Index: psutil-5.9.5/psutil/tests/test_linux.py
def test_comparisons(self):
finder = RootFsDeviceFinder()
self.assertIsNotNone(finder.find())
@@ -1378,6 +1383,7 @@ class TestRootFsDeviceFinder(PsutilTestC
@@ -1445,6 +1450,7 @@
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',
@@ -1676,6 +1682,8 @@ class TestSensorsBattery(PsutilTestCase)
'psutil._pslinux.cext.disk_partitions',
@@ -1728,6 +1734,8 @@
self.assertIsNone(psutil.sensors_battery().power_plugged)
assert m.called
@ -87,7 +69,7 @@ Index: psutil-5.9.5/psutil/tests/test_linux.py
def test_emulate_energy_full_0(self):
# Emulate a case where energy_full files returns 0.
with mock_open_content(
@@ -1683,6 +1691,8 @@ class TestSensorsBattery(PsutilTestCase)
@@ -1736,6 +1744,8 @@
self.assertEqual(psutil.sensors_battery().percent, 0)
assert m.called
@ -96,7 +78,7 @@ Index: psutil-5.9.5/psutil/tests/test_linux.py
def test_emulate_energy_full_not_avail(self):
# Emulate a case where energy_full file does not exist.
# Expected fallback on /capacity.
@@ -2275,6 +2285,7 @@ class TestProcessAgainstStatus(PsutilTes
@@ -2324,6 +2334,7 @@
value = self.read_status_file("nonvoluntary_ctxt_switches:")
self.assertEqual(self.proc.num_ctx_switches().involuntary, value)
@ -104,11 +86,37 @@ Index: psutil-5.9.5/psutil/tests/test_linux.py
def test_cpu_affinity(self):
value = self.read_status_file("Cpus_allowed_list:")
if '-' in str(value):
Index: psutil-5.9.5/psutil/tests/test_posix.py
===================================================================
--- psutil-5.9.5.orig/psutil/tests/test_posix.py
+++ psutil-5.9.5/psutil/tests/test_posix.py
@@ -413,6 +413,7 @@ class TestSystemAPIs(PsutilTestCase):
diff -Nru psutil-6.0.0.orig/psutil/tests/test_misc.py psutil-6.0.0/psutil/tests/test_misc.py
--- psutil-6.0.0.orig/psutil/tests/test_misc.py 2024-06-18 22:36:40.000000000 +0200
+++ psutil-6.0.0/psutil/tests/test_misc.py 2024-07-17 14:20:15.682456583 +0200
@@ -343,6 +343,7 @@
# # 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):
@@ -966,6 +967,7 @@
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)
@@ -987,6 +989,7 @@
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')
diff -Nru psutil-6.0.0.orig/psutil/tests/test_posix.py psutil-6.0.0/psutil/tests/test_posix.py
--- psutil-6.0.0.orig/psutil/tests/test_posix.py 2024-06-18 22:36:40.000000000 +0200
+++ psutil-6.0.0/psutil/tests/test_posix.py 2024-07-17 14:20:15.685789923 +0200
@@ -443,6 +443,7 @@
# AIX can return '-' in df output instead of numbers, e.g. for /proc
@unittest.skipIf(AIX, "unreliable on AIX")
@retry_on_failure()
@ -116,11 +124,40 @@ Index: psutil-5.9.5/psutil/tests/test_posix.py
def test_disk_usage(self):
def df(device):
try:
Index: psutil-5.9.5/psutil/tests/test_system.py
===================================================================
--- psutil-5.9.5.orig/psutil/tests/test_system.py
+++ psutil-5.9.5/psutil/tests/test_system.py
@@ -201,6 +201,7 @@ class TestMiscAPIs(PsutilTestCase):
diff -Nru psutil-6.0.0.orig/psutil/tests/test_process_all.py psutil-6.0.0/psutil/tests/test_process_all.py
--- psutil-6.0.0.orig/psutil/tests/test_process_all.py 2024-06-18 23:00:36.000000000 +0200
+++ psutil-6.0.0/psutil/tests/test_process_all.py 2024-07-17 14:28:46.700089665 +0200
@@ -15,6 +15,7 @@
import stat
import time
import traceback
+import unittest
import psutil
from psutil import AIX
@@ -130,6 +131,7 @@
ls.append(proc_info(pid))
return ls
+ @unittest.skip("Fails in OBS")
def test_all(self):
failures = []
for info in self.iter_proc_info():
diff -Nru psutil-6.0.0.orig/psutil/tests/test_process.py psutil-6.0.0/psutil/tests/test_process.py
--- psutil-6.0.0.orig/psutil/tests/test_process.py 2024-06-18 22:36:40.000000000 +0200
+++ psutil-6.0.0/psutil/tests/test_process.py 2024-07-17 14:20:15.685789923 +0200
@@ -360,6 +360,7 @@
@unittest.skipIf(not HAS_IONICE, "not supported")
@unittest.skipIf(not LINUX, "linux only")
+ @unittest.skip("Unreliable in OBS")
def test_ionice_linux(self):
def cleanup(init):
ioclass, value = init
diff -Nru psutil-6.0.0.orig/psutil/tests/test_system.py psutil-6.0.0/psutil/tests/test_system.py
--- psutil-6.0.0.orig/psutil/tests/test_system.py 2024-06-18 22:36:40.000000000 +0200
+++ psutil-6.0.0/psutil/tests/test_system.py 2024-07-17 14:25:27.213045941 +0200
@@ -243,6 +243,7 @@
self.assertLess(bt, time.time())
@unittest.skipIf(CI_TESTING and not psutil.users(), "unreliable on CI")
@ -128,7 +165,15 @@ Index: psutil-5.9.5/psutil/tests/test_system.py
def test_users(self):
users = psutil.users()
self.assertNotEqual(users, [])
@@ -586,6 +587,7 @@ class TestDiskAPIs(PsutilTestCase):
@@ -591,6 +592,7 @@
MACOS and platform.machine() == 'arm64', "skipped due to #1892"
)
@unittest.skipIf(not HAS_CPU_FREQ, "not supported")
+ @unittest.skip("Fails in OBS")
def test_cpu_freq(self):
def check_ls(ls):
for nt in ls:
@@ -662,6 +664,7 @@
def test_disk_usage_bytes(self):
psutil.disk_usage(b'.')
@ -136,27 +181,3 @@ Index: psutil-5.9.5/psutil/tests/test_system.py
def test_disk_partitions(self):
def check_ntuple(nt):
self.assertIsInstance(nt.device, str)
Index: psutil-5.9.5/psutil/tests/test_contracts.py
===================================================================
--- psutil-5.9.5.orig/psutil/tests/test_contracts.py
+++ psutil-5.9.5/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.5/psutil/tests/test_process.py
===================================================================
--- psutil-5.9.5.orig/psutil/tests/test_process.py
+++ psutil-5.9.5/psutil/tests/test_process.py
@@ -346,6 +346,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:

View File

@ -1,56 +0,0 @@
---
psutil/tests/test_process.py | 6 ++++++
1 file changed, 6 insertions(+)
Index: psutil-5.9.5/psutil/tests/test_process.py
===================================================================
--- psutil-5.9.5.orig/psutil/tests/test_process.py
+++ psutil-5.9.5/psutil/tests/test_process.py
@@ -419,6 +419,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())
@@ -442,6 +443,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))
@@ -455,6 +457,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()
@@ -475,6 +478,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.
@@ -490,6 +494,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
@@ -1320,6 +1325,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: