forked from pool/python-psutil
- Add upstream pytest9.patch to fix tests
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-psutil?expand=0&rev=190
This commit is contained in:
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
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.osc
|
||||
3
_multibuild
Normal file
3
_multibuild
Normal file
@@ -0,0 +1,3 @@
|
||||
<multibuild>
|
||||
<package>test</package>
|
||||
</multibuild>
|
||||
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-7.0.0.tar.gz
(Stored with Git LFS)
Normal file
BIN
psutil-7.0.0.tar.gz
(Stored with Git LFS)
Normal file
Binary file not shown.
3
psutil-7.1.0.tar.gz
Normal file
3
psutil-7.1.0.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:655708b3c069387c8b77b072fc429a57d0e214221d01c0a772df7dfedcb3bcd2
|
||||
size 497660
|
||||
3
psutil-7.1.1.tar.gz
Normal file
3
psutil-7.1.1.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:092b6350145007389c1cfe5716050f02030a05219d90057ea867d18fe8d372fc
|
||||
size 487067
|
||||
3
psutil-7.1.2.tar.gz
Normal file
3
psutil-7.1.2.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:aa225cdde1335ff9684708ee8c72650f6598d5ed2114b9a7c5802030b1785018
|
||||
size 487424
|
||||
3
psutil-7.1.3.tar.gz
Normal file
3
psutil-7.1.3.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6c86281738d77335af7aec228328e944b30930899ea760ecf33a4dba66be5e74
|
||||
size 489059
|
||||
52
pytest9.patch
Normal file
52
pytest9.patch
Normal file
@@ -0,0 +1,52 @@
|
||||
From 40e27872d534ed849245fdb0c4604ca678d5e9fc Mon Sep 17 00:00:00 2001
|
||||
From: Giampaolo Rodola <g.rodola@gmail.com>
|
||||
Date: Sun, 23 Nov 2025 00:08:41 +0100
|
||||
Subject: [PATCH] Make ntuples work with subTest of new pytest release
|
||||
|
||||
When running tests in parallel, the new pytest 9.X is unable to
|
||||
de/serialize nametuples when passed as:
|
||||
|
||||
with self.subTest(foo=ntuple):
|
||||
...
|
||||
---
|
||||
tests/test_posix.py | 2 +-
|
||||
tests/test_system.py | 6 ++++--
|
||||
2 files changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/psutil/tests/test_posix.py b/psutil/tests/test_posix.py
|
||||
index 2cc9dbd84c..ab2c10c9f3 100755
|
||||
--- a/psutil/tests/test_posix.py
|
||||
+++ b/psutil/tests/test_posix.py
|
||||
@@ -416,7 +416,7 @@ def test_users_started(self):
|
||||
if not tstamp:
|
||||
return pytest.skip(f"cannot interpret tstamp in who output\n{out}")
|
||||
|
||||
- with self.subTest(psutil=psutil.users(), who=out):
|
||||
+ with self.subTest(psutil=str(psutil.users()), who=out):
|
||||
for idx, u in enumerate(psutil.users()):
|
||||
psutil_value = datetime.datetime.fromtimestamp(
|
||||
u.started
|
||||
diff --git a/psutil/tests/test_system.py b/psutil/tests/test_system.py
|
||||
index 79325c7599..c00ab6fb96 100755
|
||||
--- a/psutil/tests/test_system.py
|
||||
+++ b/psutil/tests/test_system.py
|
||||
@@ -244,7 +244,7 @@ def test_users(self):
|
||||
users = psutil.users()
|
||||
assert users
|
||||
for user in users:
|
||||
- with self.subTest(user=user):
|
||||
+ with self.subTest(user=str(user)):
|
||||
assert user.name
|
||||
assert isinstance(user.name, str)
|
||||
assert isinstance(user.terminal, (str, type(None)))
|
||||
@@ -488,7 +488,9 @@ def test_cpu_times_comparison(self):
|
||||
per_cpu = psutil.cpu_times(percpu=True)
|
||||
summed_values = base._make([sum(num) for num in zip(*per_cpu)])
|
||||
for field in base._fields:
|
||||
- with self.subTest(field=field, base=base, per_cpu=per_cpu):
|
||||
+ with self.subTest(
|
||||
+ field=field, base=str(base), per_cpu=str(per_cpu)
|
||||
+ ):
|
||||
assert (
|
||||
abs(getattr(base, field) - getattr(summed_values, field))
|
||||
< 2
|
||||
1835
python-psutil.changes
Normal file
1835
python-psutil.changes
Normal file
File diff suppressed because it is too large
Load Diff
116
python-psutil.spec
Normal file
116
python-psutil.spec
Normal file
@@ -0,0 +1,116 @@
|
||||
#
|
||||
# spec file for package python-psutil
|
||||
#
|
||||
# Copyright (c) 2025 SUSE LLC and contributors
|
||||
#
|
||||
# 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/
|
||||
#
|
||||
|
||||
|
||||
%global flavor @BUILD_FLAVOR@%{nil}
|
||||
%if "%{flavor}" == "test"
|
||||
%ifarch x86_64 %{ix86}
|
||||
%define psuffix -%{flavor}
|
||||
%bcond_without test
|
||||
%else
|
||||
ExclusiveArch: donotbuild
|
||||
%endif
|
||||
%else
|
||||
%define psuffix %{nil}
|
||||
%bcond_with test
|
||||
%endif
|
||||
%{?sle15_python_module_pythons}
|
||||
Name: python-psutil%{psuffix}
|
||||
Version: 7.1.3
|
||||
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 https://github.com/giampaolo/psutil/commit/40e27872d534ed849245fdb0c4604ca678d5e9fc Make ntuples work with subTest of new pytest release
|
||||
Patch: pytest9.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: pkgconfig(libsystemd)
|
||||
%if %{with test}
|
||||
%if 0%{?suse_version} > 1500
|
||||
BuildRequires: /usr/bin/who
|
||||
%endif
|
||||
BuildRequires: %{python_module psutil = %{version}}
|
||||
BuildRequires: %{python_module pytest-subtests}
|
||||
BuildRequires: %{python_module pytest-xdist}
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: net-tools
|
||||
%endif
|
||||
%python_subpackages
|
||||
|
||||
%description
|
||||
A graphical interface that lets you easily analyze and introspect unaltered running Python processes.
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n psutil-%{version}
|
||||
# do not require pytest-instafail
|
||||
sed -i '/instafail/d' pyproject.toml
|
||||
|
||||
%build
|
||||
%if !%{with test}
|
||||
%pyproject_wheel
|
||||
%endif
|
||||
|
||||
%install
|
||||
%if !%{with test}
|
||||
%pyproject_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}
|
||||
}
|
||||
%endif
|
||||
|
||||
%if %{with test}
|
||||
%check
|
||||
export LANG=en_US.UTF-8
|
||||
export PSUTIL_TESTING=1
|
||||
export PSUTIL_DEBUG=1
|
||||
export PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
|
||||
# needs to be built with extensions to run scripts
|
||||
%python_expand PYTHON=$python make build
|
||||
# test_who, test_users - need running session
|
||||
SKIPTEST="(test_who and Scripts) or (test_users and TestMiscAPIs)"
|
||||
# test_import_all - pulls in too many dependencies
|
||||
SKIPTEST="$SKIPTEST or (test_import_all and Scripts)"
|
||||
# test_all - flaky
|
||||
SKIPTEST="$SKIPTEST or (test_all and TestFetchAllProcesses)"
|
||||
# test_multi_sockets_procs - not sure why it fails
|
||||
SKIPTEST="$SKIPTEST or (test_multi_sockets_procs and TestSystemWideConnections)"
|
||||
%pytest_arch -n auto --ignore=psutil/tests/test_memleaks.py --ignore=psutil/tests/test_sudo.py -k "not ($SKIPTEST)"
|
||||
%endif
|
||||
|
||||
%if !%{with test}
|
||||
%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}.dist-info
|
||||
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
Reference in New Issue
Block a user