File support-pytest-9.patch of Package python-pywbem

From 757a4903276169088fa0010fe03c823b94ecc30a Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Wed, 26 Nov 2025 15:21:46 +1100
Subject: [PATCH] Update pytest_collect_file hook

pytest_collect_file from pytest 7 on has deprecated the py.path
arguments and replaced them with pathlib equivalents, bump the minimum
version of pytest installed and use the new argument.
---
 test-requirements.txt          | 2 +-
 tests/functiontest/conftest.py | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/test-requirements.txt b/test-requirements.txt
index 088ab84da..43b013a16 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -23,7 +23,7 @@ packaging>=24.1
 # Max pytest version < 8.0 because of issue with Deprecated warnings in pytest 8.0.x.
 # pytest-cov 4.0.0 depends on pytest>=4.6
 pytest>=4.6.0,!=6.0,<8.0; python_version <= '3.9'
-pytest>=6.2.5,<8.0; python_version >= '3.10'
+pytest>=7.0.0,<10.0; python_version >= '3.10'
 testfixtures>=6.9.0
 # pylint>=2.15 requires colorama>=0.4.5
 colorama>=0.4.5
diff --git a/tests/functiontest/conftest.py b/tests/functiontest/conftest.py
index 79481361c..ea39cd462 100644
--- a/tests/functiontest/conftest.py
+++ b/tests/functiontest/conftest.py
@@ -205,17 +205,17 @@ def patched_makefile(self, mode='r', bufsize=-1):
     return self.fd
 
 
-def pytest_collect_file(parent, path):
+def pytest_collect_file(parent, file_path):
     """
     py.test hook that is called for a directory to collect its test files.
 
     For an example very similar to what we do here, see
     https://docs.pytest.org/en/latest/example/nonpython.html
     """
-    if path.ext == ".yaml":
+    if file_path.suffix == ".yaml":
         if hasattr(YamlFile, 'from_parent'):
             # pylint: disable=no-member
-            return YamlFile.from_parent(fspath=path, parent=parent)
+            return YamlFile.from_parent(path=file_path, parent=parent)
         # Direct creation has been deprecated in pytest, but
         # from_parent() was introduced only in pytest 6.0.0 and we
         # have to pin to lower pytest versions on py27/py34/py35.
openSUSE Build Service is sponsored by