forked from pool/python-psutil
Accepting request 1320594 from devel:languages:python
Forwarded request #1320330 from mcalabkova - Add upstream pytest9.patch to fix tests OBS-URL: https://build.opensuse.org/request/show/1320594 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-psutil?expand=0&rev=89
This commit is contained in:
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
|
||||
@@ -1,3 +1,8 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Nov 27 11:31:09 UTC 2025 - Markéta Machová <mmachova@suse.com>
|
||||
|
||||
- Add upstream pytest9.patch to fix tests
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Nov 11 14:02:16 UTC 2025 - Markéta Machová <mmachova@suse.com>
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@ 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}
|
||||
|
||||
Reference in New Issue
Block a user