From 85d0cb9c39b474b1f61f71316a56f16e387a41d9a99a20197dabf0de0d40ed2f Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Thu, 27 Nov 2025 19:20:38 +1100 Subject: [PATCH 1/2] - Only require pytest-subtests with pytest < 9. --- python-pytest-shell-utilities.changes | 5 +++++ python-pytest-shell-utilities.spec | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/python-pytest-shell-utilities.changes b/python-pytest-shell-utilities.changes index d7eace0..8e88ea5 100644 --- a/python-pytest-shell-utilities.changes +++ b/python-pytest-shell-utilities.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Nov 27 08:20:15 UTC 2025 - Steve Kowalik + +- Only require pytest-subtests with pytest < 9. + ------------------------------------------------------------------- Mon Nov 17 09:53:35 UTC 2025 - Daniel Garcia diff --git a/python-pytest-shell-utilities.spec b/python-pytest-shell-utilities.spec index 09d01aa..9808c89 100644 --- a/python-pytest-shell-utilities.spec +++ b/python-pytest-shell-utilities.spec @@ -48,7 +48,7 @@ BuildRequires: %{python_module pytest >= 7.3.0} BuildRequires: %{python_module pytest-helpers-namespace} BuildRequires: %{python_module pytest-shell-utilities = %{version}} BuildRequires: %{python_module pytest-skip-markers} -BuildRequires: %{python_module pytest-subtests} +BuildRequires: %{python_module pytest-subtests if %python-pytest < 9} BuildRequires: %{python_module typing-extensions} %endif # /SECTION -- 2.51.1 From b4ad08b8dc91108638348541c7c3dd731510484050930085b299b63d47cb6800 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Fri, 28 Nov 2025 12:00:51 +1100 Subject: [PATCH 2/2] - Add patch support-pytest-9.patch: * Import from pytest, falling back to pytest_subtests. --- python-pytest-shell-utilities.changes | 4 ++- python-pytest-shell-utilities.spec | 2 ++ support-pytest-9.patch | 45 +++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 support-pytest-9.patch diff --git a/python-pytest-shell-utilities.changes b/python-pytest-shell-utilities.changes index 8e88ea5..05dae04 100644 --- a/python-pytest-shell-utilities.changes +++ b/python-pytest-shell-utilities.changes @@ -1,7 +1,9 @@ ------------------------------------------------------------------- -Thu Nov 27 08:20:15 UTC 2025 - Steve Kowalik +Fri Nov 28 01:00:22 UTC 2025 - Steve Kowalik - Only require pytest-subtests with pytest < 9. +- Add patch support-pytest-9.patch: + * Import from pytest, falling back to pytest_subtests. ------------------------------------------------------------------- Mon Nov 17 09:53:35 UTC 2025 - Daniel Garcia diff --git a/python-pytest-shell-utilities.spec b/python-pytest-shell-utilities.spec index 9808c89..4e3a873 100644 --- a/python-pytest-shell-utilities.spec +++ b/python-pytest-shell-utilities.spec @@ -34,6 +34,8 @@ URL: https://github.com/saltstack/pytest-shell-utilities Source: https://files.pythonhosted.org/packages/source/p/pytest-shell-utilities/pytest_shell_utilities-%{version}.tar.gz # PATCH-FIX-UPSTREAM python314.patch gh#saltstack/pytest-shell-utilities#57 Patch0: python314.patch +# PATCH-FIX-UPSTREAM gh#saltstack/pytest-shell-utilities#58 +Patch1: support-pytest-9.patch BuildRequires: %{python_module pip} BuildRequires: %{python_module setuptools >= 50.3.2} BuildRequires: %{python_module setuptools_scm >= 3.4} diff --git a/support-pytest-9.patch b/support-pytest-9.patch new file mode 100644 index 0000000..907fcc2 --- /dev/null +++ b/support-pytest-9.patch @@ -0,0 +1,45 @@ +From b6f26e62a20fc8c42635a2b868e8915cc2a0b21d Mon Sep 17 00:00:00 2001 +From: Steve Kowalik +Date: Fri, 28 Nov 2025 11:27:17 +1100 +Subject: [PATCH] Support pytest 9 + +pytest 9 has included support for subtests, marking pytest_subtests as +unmaintained at the same time -- attempt to import from pytest first, +falling back to pytest_subtests if required. +--- + tests/functional/shell/test_script_subprocess.py | 5 ++++- + tests/unit/utils/processes/test_processresult.py | 5 ++++- + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/tests/functional/shell/test_script_subprocess.py b/tests/functional/shell/test_script_subprocess.py +index 3bbc6d5..3255056 100644 +--- a/tests/functional/shell/test_script_subprocess.py ++++ b/tests/functional/shell/test_script_subprocess.py +@@ -8,7 +8,10 @@ + from typing import cast + + import pytest +-from pytest_subtests import SubTests ++try: ++ from pytest import Subtests as SubTests ++except ImportError: ++ from pytest_subtests import SubTests + + from pytestshellutils.customtypes import EnvironDict + from pytestshellutils.exceptions import FactoryTimeout +diff --git a/tests/unit/utils/processes/test_processresult.py b/tests/unit/utils/processes/test_processresult.py +index 3ab90fd..5c88a52 100644 +--- a/tests/unit/utils/processes/test_processresult.py ++++ b/tests/unit/utils/processes/test_processresult.py +@@ -8,7 +8,10 @@ + import textwrap + + import pytest +-from pytest_subtests import SubTests ++try: ++ from pytest import Subtests as SubTests ++except ImportError: ++ from pytest_subtests import SubTests + + from pytestshellutils.utils.processes import ProcessResult + -- 2.51.1