Sync from SUSE:ALP:Source:Standard:1.0 saltbundlepy-psutil revision 4a3fc4b29681112d414851d300f956bc
This commit is contained in:
commit
14a74ab24a
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
14
logind_y2038-prevent-setup-fails.patch
Normal file
14
logind_y2038-prevent-setup-fails.patch
Normal file
@ -0,0 +1,14 @@
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -185,7 +185,10 @@
|
||||
|
||||
|
||||
def get_systemd_version():
|
||||
- r = subprocess.run(["systemctl", "--version"], capture_output=True)
|
||||
+ try:
|
||||
+ r = subprocess.run(["systemctl", "--version"], capture_output=True)
|
||||
+ except FileNotFoundError:
|
||||
+ return 0
|
||||
if r.returncode != 0:
|
||||
return 0
|
||||
out = r.stdout.split()
|
233
logind_y2038.patch
Normal file
233
logind_y2038.patch
Normal file
@ -0,0 +1,233 @@
|
||||
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)
|
||||
|
34
mem-used-bsc1181475.patch
Normal file
34
mem-used-bsc1181475.patch
Normal file
@ -0,0 +1,34 @@
|
||||
---
|
||||
psutil/_pslinux.py | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
Index: psutil-5.9.5/psutil/_pslinux.py
|
||||
===================================================================
|
||||
--- psutil-5.9.5.orig/psutil/_pslinux.py
|
||||
+++ psutil-5.9.5/psutil/_pslinux.py
|
||||
@@ -474,12 +474,6 @@ def virtual_memory():
|
||||
except KeyError:
|
||||
slab = 0
|
||||
|
||||
- used = total - free - cached - buffers
|
||||
- if used < 0:
|
||||
- # May be symptomatic of running within a LCX container where such
|
||||
- # values will be dramatically distorted over those of the host.
|
||||
- used = total - free
|
||||
-
|
||||
# - starting from 4.4.0 we match free's "available" column.
|
||||
# Before 4.4.0 we calculated it as (free + buffers + cached)
|
||||
# which matched htop.
|
||||
@@ -510,6 +504,12 @@ def virtual_memory():
|
||||
# 24fd2605c51fccc375ab0287cec33aa767f06718/proc/sysinfo.c#L764
|
||||
avail = free
|
||||
|
||||
+ used = total - avail
|
||||
+ if used < 0:
|
||||
+ # May be symptomatic of running within a LCX container where such
|
||||
+ # values will be dramatically distorted over those of the host.
|
||||
+ used = total - free
|
||||
+
|
||||
percent = usage_percent((total - avail), total, round_=1)
|
||||
|
||||
# Warn about missing metrics which are set to 0.
|
BIN
psutil-5.9.5.tar.gz
(Stored with Git LFS)
Normal file
BIN
psutil-5.9.5.tar.gz
(Stored with Git LFS)
Normal file
Binary file not shown.
1555
saltbundlepy-psutil.changes
Normal file
1555
saltbundlepy-psutil.changes
Normal file
File diff suppressed because it is too large
Load Diff
114
saltbundlepy-psutil.spec
Normal file
114
saltbundlepy-psutil.spec
Normal file
@ -0,0 +1,114 @@
|
||||
#
|
||||
# spec file for package saltbundlepy-psutil
|
||||
#
|
||||
# Copyright (c) 2023 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
|
||||
%{?!saltbundlepy_module:%define saltbundlepy_module() saltbundlepy-%{**}}
|
||||
%define pythons saltbundlepy
|
||||
|
||||
# Disable python bytecompile for all distros
|
||||
# It's called explicitly in the spec
|
||||
%global __brp_python_bytecompile %{nil}
|
||||
|
||||
%ifarch x86_64 %{ix86}
|
||||
%bcond_without test
|
||||
%else
|
||||
%bcond_with test
|
||||
%endif
|
||||
|
||||
Name: saltbundlepy-psutil
|
||||
Version: 5.9.5
|
||||
Release: 0
|
||||
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
|
||||
# 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
|
||||
# The previous patch causing traceback on calling setup.py if systemctl is unavailable
|
||||
Patch6: logind_y2038-prevent-setup-fails.patch
|
||||
Patch7: skip-flacky-tests-on-obs.patch
|
||||
%if 0%{?debian} || 0%{?rhel}
|
||||
# Skip the test which is unreliable on CI for Debian and Red Hat based systems in OBS
|
||||
Patch8: skip-obs-unreliable-debian-rhel-ionice-test.patch
|
||||
%endif
|
||||
%if 0%{?suse_version} == 1110
|
||||
Patch9: skip-test_rlimit-on-SLE11.patch
|
||||
%endif
|
||||
BuildRequires: %{saltbundlepy_module devel >= 3.10}
|
||||
BuildRequires: %{saltbundlepy_module setuptools}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: saltbundlepy-rpm-macros
|
||||
Requires: net-tools
|
||||
Requires: procps
|
||||
%if %{with test}
|
||||
BuildRequires: net-tools
|
||||
BuildRequires: procps
|
||||
BuildRequires: /usr/bin/who
|
||||
%endif
|
||||
%python_subpackages
|
||||
|
||||
%description
|
||||
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}
|
||||
|
||||
%build
|
||||
%python_build
|
||||
|
||||
%install
|
||||
%python_install
|
||||
|
||||
%{python_expand mkdir -p %{buildroot}%{_docdir}/%{$python_prefix}-psutil
|
||||
cp -r scripts %{buildroot}%{_docdir}/%{$python_prefix}-psutil/
|
||||
find %{buildroot}%{_docdir}/%{$python_prefix}-psutil/scripts/ -type f -name "*.py" -exec sed -i "s|#!%{_bindir}/env python.*|#!%{__$python}|" {} \;
|
||||
%fdupes %{buildroot}%{_docdir}/%{$python_prefix}-psutil/
|
||||
%fdupes %{buildroot}%{$python_sitearch}
|
||||
}
|
||||
|
||||
%if %{with test}
|
||||
%check
|
||||
export LANG=en_US.UTF-8
|
||||
export PSUTIL_TESTING=1
|
||||
export PSUTIL_DEBUG=1
|
||||
export PYTHONDONTRWRITEBYTECODE=1
|
||||
mkdir testd
|
||||
pushd testd
|
||||
%python_expand PYTHONPATH=%{buildroot}%{$python_sitearch} $python -Wa -m psutil.tests
|
||||
popd
|
||||
%endif
|
||||
|
||||
%files %{python_files}
|
||||
%license LICENSE
|
||||
%doc CREDITS HISTORY.rst README.rst
|
||||
%{_docdir}/%{python_prefix}-psutil/scripts/
|
||||
%{python_sitearch}/psutil/
|
||||
%exclude %{python_sitearch}/psutil/tests
|
||||
%{python_sitearch}/psutil-%{version}*-info
|
||||
|
||||
%changelog
|
27
skip-flacky-tests-on-obs.patch
Normal file
27
skip-flacky-tests-on-obs.patch
Normal file
@ -0,0 +1,27 @@
|
||||
diff -urN a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py
|
||||
--- a/psutil/tests/test_linux.py 2023-12-14 09:59:41.727711649 +0100
|
||||
+++ b/psutil/tests/test_linux.py 2023-12-14 10:38:38.219968536 +0100
|
||||
@@ -257,6 +257,7 @@
|
||||
psutil_value = psutil.virtual_memory().total
|
||||
self.assertEqual(cli_value, psutil_value)
|
||||
|
||||
+ @unittest.skip("Flacky in OBS")
|
||||
@retry_on_failure()
|
||||
def test_used(self):
|
||||
# Older versions of procps used slab memory to calculate used memory.
|
||||
@@ -313,6 +314,7 @@
|
||||
self.assertAlmostEqual(
|
||||
vmstat_value, psutil_value, delta=TOLERANCE_SYS_MEM)
|
||||
|
||||
+ @unittest.skip("Flacky in OBS")
|
||||
@retry_on_failure()
|
||||
def test_used(self):
|
||||
# Older versions of procps used slab memory to calculate used memory.
|
||||
@@ -1376,6 +1378,7 @@
|
||||
if base and c:
|
||||
self.assertEqual(base, c)
|
||||
|
||||
+ @unittest.skip("Fails in OBS")
|
||||
@unittest.skipIf(not which("findmnt"), "findmnt utility not available")
|
||||
@unittest.skipIf(GITHUB_ACTIONS, "unsupported on GITHUB_ACTIONS")
|
||||
def test_against_findmnt(self):
|
10
skip-obs-unreliable-debian-rhel-ionice-test.patch
Normal file
10
skip-obs-unreliable-debian-rhel-ionice-test.patch
Normal file
@ -0,0 +1,10 @@
|
||||
--- a/psutil/tests/test_process.py
|
||||
+++ b/psutil/tests/test_process.py
|
||||
@@ -344,6 +344,7 @@
|
||||
self.assertGreaterEqual(io2[i], 0)
|
||||
self.assertGreaterEqual(io2[i], 0)
|
||||
|
||||
+ @unittest.skipIf(True, "could be flacky in obs with Debian or Red Hat based systems")
|
||||
@unittest.skipIf(not HAS_IONICE, "not supported")
|
||||
@unittest.skipIf(not LINUX, "linux only")
|
||||
@unittest.skip("Unreliable in OBS")
|
18
skip-test_rlimit-on-SLE11.patch
Normal file
18
skip-test_rlimit-on-SLE11.patch
Normal file
@ -0,0 +1,18 @@
|
||||
--- a/psutil/tests/test_contracts.py
|
||||
+++ b/psutil/tests/test_contracts.py
|
||||
@@ -94,6 +94,7 @@
|
||||
|
||||
@unittest.skipIf(GITHUB_ACTIONS and LINUX,
|
||||
"unsupported on GITHUB_ACTIONS + LINUX")
|
||||
+ @unittest.skipIf(True, "Failing for SLE11")
|
||||
def test_rlimit(self):
|
||||
ae = self.assertEqual
|
||||
ae(hasattr(psutil, "RLIM_INFINITY"), LINUX or FREEBSD)
|
||||
@@ -171,6 +172,7 @@
|
||||
|
||||
@unittest.skipIf(GITHUB_ACTIONS and LINUX,
|
||||
"unsupported on GITHUB_ACTIONS + LINUX")
|
||||
+ @unittest.skipIf(True, "Failing for SLE11")
|
||||
def test_rlimit(self):
|
||||
self.assertEqual(hasattr(psutil.Process, "rlimit"), LINUX or FREEBSD)
|
||||
|
162
skip_failing_tests.patch
Normal file
162
skip_failing_tests.patch
Normal file
@ -0,0 +1,162 @@
|
||||
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)
|
||||
|
||||
+ @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
|
||||
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('#')])
|
||||
@@ -756,6 +757,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()
|
||||
@@ -1134,6 +1136,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"
|
||||
@@ -1308,6 +1311,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':
|
||||
@@ -1351,6 +1355,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())
|
||||
@@ -1378,6 +1383,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',
|
||||
@@ -1676,6 +1682,8 @@ class TestSensorsBattery(PsutilTestCase)
|
||||
self.assertIsNone(psutil.sensors_battery().power_plugged)
|
||||
assert m.called
|
||||
|
||||
+ @unittest.skipUnless(os.path.exists('/sys/class/power_supply/BAT0/energy_full'),
|
||||
+ 'Missing /sys/class/power_supply/BAT0/energy_full file.')
|
||||
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)
|
||||
self.assertEqual(psutil.sensors_battery().percent, 0)
|
||||
assert m.called
|
||||
|
||||
+ @unittest.skipUnless(os.path.exists('/sys/class/power_supply/BAT0/energy_full'),
|
||||
+ 'Missing /sys/class/power_supply/BAT0/energy_full file.')
|
||||
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
|
||||
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.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):
|
||||
# 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):
|
||||
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):
|
||||
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.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:
|
56
skip_rlimit_tests_on_python2.patch
Normal file
56
skip_rlimit_tests_on_python2.patch
Normal file
@ -0,0 +1,56 @@
|
||||
---
|
||||
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:
|
Loading…
Reference in New Issue
Block a user