From c262b4f6cece4c72f8378997b0aa29c3d9c76a4dbd22123f3da45eec45123dff Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Sat, 29 Nov 2025 22:09:45 +0000 Subject: [PATCH] Accepting request 1320330 from home:mcalabkova:branches:devel:languages:python:pytest - Add upstream pytest9.patch to fix tests OBS-URL: https://build.opensuse.org/request/show/1320330 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-psutil?expand=0&rev=190 --- pytest9.patch | 52 +++++++++++++++++++++++++++++++++++++++++++ python-psutil.changes | 5 +++++ python-psutil.spec | 2 ++ 3 files changed, 59 insertions(+) create mode 100644 pytest9.patch diff --git a/pytest9.patch b/pytest9.patch new file mode 100644 index 0000000..76e48d8 --- /dev/null +++ b/pytest9.patch @@ -0,0 +1,52 @@ +From 40e27872d534ed849245fdb0c4604ca678d5e9fc Mon Sep 17 00:00:00 2001 +From: Giampaolo Rodola +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 diff --git a/python-psutil.changes b/python-psutil.changes index 89f9ea0..4086251 100644 --- a/python-psutil.changes +++ b/python-psutil.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Nov 27 11:31:09 UTC 2025 - Markéta Machová + +- Add upstream pytest9.patch to fix tests + ------------------------------------------------------------------- Tue Nov 11 14:02:16 UTC 2025 - Markéta Machová diff --git a/python-psutil.spec b/python-psutil.spec index 0adf863..947c687 100644 --- a/python-psutil.spec +++ b/python-psutil.spec @@ -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}