From 126aa04c9cc79c54924c3b92ba6efeda7644b305d998786563b89bed10ef9045 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Moreno Date: Wed, 21 Jan 2026 11:59:39 +0100 Subject: [PATCH] pytest 9.0 compat Add upstream patch pytest9.patch to make it compatible with pytest 9.0, gh#freakboy3742/pytest-tldr@861b6a06575e --- pytest9.patch | 139 +++++++++++++++++++++++++++++++++++++ python-pytest-tldr.changes | 6 ++ python-pytest-tldr.spec | 2 + 3 files changed, 147 insertions(+) create mode 100644 pytest9.patch diff --git a/pytest9.patch b/pytest9.patch new file mode 100644 index 0000000..4284912 --- /dev/null +++ b/pytest9.patch @@ -0,0 +1,139 @@ +From 861b6a06575e764d751eee4aa7929b21cee7e32e Mon Sep 17 00:00:00 2001 +From: Konrad Weihmann <46938494+priv-kweihmann@users.noreply.github.com> +Date: Mon, 10 Nov 2025 23:57:15 +0100 +Subject: [PATCH] Adapt to API deprecation in pytest 9.x (#39) + +Signed-off-by: Konrad Weihmann +Co-authored-by: Russell Keith-Magee +--- + .github/dependabot.yml | 19 +++++++ + .github/workflows/ci.yml | 57 +++++-------------- + .github/workflows/pre-commit-update.yml | 18 ++++++ + .pre-commit-config.yaml | 32 +++-------- + changes/39.feature.1.rst | 1 + + changes/39.feature.2.rst | 1 + + changes/39.feature.3.rst | 1 + + changes/39.removal.1.rst | 1 + + changes/39.removal.2.rst | 1 + + pyproject.toml | 74 ++++++++++++++++++++----- + pytest_tldr.py | 31 +++-------- + tests/test_plugins.py | 2 +- + tests/test_unittest.py | 10 ---- + tox.ini | 49 +++------------- + 14 files changed, 144 insertions(+), 153 deletions(-) + create mode 100644 .github/dependabot.yml + create mode 100644 .github/workflows/pre-commit-update.yml + create mode 100644 changes/39.feature.1.rst + create mode 100644 changes/39.feature.2.rst + create mode 100644 changes/39.feature.3.rst + create mode 100644 changes/39.removal.1.rst + create mode 100644 changes/39.removal.2.rst + +Index: pytest-tldr-0.2.5/pytest_tldr.py +=================================================================== +--- pytest-tldr-0.2.5.orig/pytest_tldr.py ++++ pytest-tldr-0.2.5/pytest_tldr.py +@@ -6,17 +6,6 @@ import pluggy + import py + import pytest + +-try: +- from pytest import ExitCode +-except ImportError: +- # PyTest <5 compatibibility +- from _pytest.main import EXIT_OK, EXIT_TESTSFAILED +- +- class ExitCode: +- OK = EXIT_OK +- TESTS_FAILED = EXIT_TESTSFAILED +- +- + __version__ = "0.2.5" + + +@@ -35,12 +24,11 @@ def pytest_configure(config): + + def _plugin_nameversions(plugininfo): + values = [] +- for plugin, dist in plugininfo: ++ for _, dist in plugininfo: + # gets us name and version! +- name = "{dist.project_name}-{dist.version}".format(dist=dist) ++ name = f"{dist.project_name}-{dist.version}" + # questionable convenience, but it keeps things short +- if name.startswith("pytest-"): +- name = name[7:] ++ name = name.removeprefix("pytest-") + # we decided to print python package names + # they can have more than one plugin + if name not in values: +@@ -71,7 +59,7 @@ class TLDRReporter: + # Plugin compatibility methods. + # + # TLDR overwrites TerminalReporter, but some plugins depend +- # on the outout capabilities of TerminalReporter. Preserve them, ++ # on the output capabilities of TerminalReporter. Preserve them, + # to the extent possible. + ###################################################################### + +@@ -158,7 +146,7 @@ class TLDRReporter: + self.print(f"pluggy=={pluggy.__version__}") + + headers = self.config.hook.pytest_report_header( +- config=self.config, startdir=py.path.local() ++ config=self.config, start_path=py.path.local() + ) + for header in headers: + if isinstance(header, str): +@@ -330,14 +318,9 @@ class TLDRReporter: + self.print() + + self.print("-" * 78) +- self.print( +- "Ran {n_tests} tests in {duration:.2f}s".format( +- n_tests=self._n_tests, +- duration=duration, +- ) +- ) ++ self.print(f"Ran {self._n_tests} tests in {duration:.2f}s") + +- if exitstatus in {ExitCode.OK, ExitCode.TESTS_FAILED}: ++ if exitstatus in {pytest.ExitCode.OK, pytest.ExitCode.TESTS_FAILED}: + self.config.hook.pytest_terminal_summary( + config=self.config, + terminalreporter=self, +Index: pytest-tldr-0.2.5/tests/test_plugins.py +=================================================================== +--- pytest-tldr-0.2.5.orig/tests/test_plugins.py ++++ pytest-tldr-0.2.5/tests/test_plugins.py +@@ -10,7 +10,7 @@ def test_coverage(testdir): + result.stdout.fnmatch_lines( + [ + "test_coverage.py::test_coverage ... ok", +- "*_____ coverage: platform *_____", ++ "* coverage: platform *", + "Name Stmts Miss Cover", + "--------------------------------------", + "test_coverage.py 2 0 100%", +Index: pytest-tldr-0.2.5/tests/test_unittest.py +=================================================================== +--- pytest-tldr-0.2.5.orig/tests/test_unittest.py ++++ pytest-tldr-0.2.5/tests/test_unittest.py +@@ -1,6 +1,3 @@ +-import sys +- +- + def test_pass(testdir): + testdir.makepyfile( + """ +@@ -127,10 +124,3 @@ def test_upass(testdir): + "*::TestCase::test_unexpected_success ... unexpected success", + ] + ) +- +- # pytest under Python2 reports an unexpected pass as a success, +- # but a failure under Python3. +- if sys.version_info.major == 2: +- assert result.ret == 0 +- else: +- assert result.ret == 1 diff --git a/python-pytest-tldr.changes b/python-pytest-tldr.changes index ddcea14..b873ed7 100644 --- a/python-pytest-tldr.changes +++ b/python-pytest-tldr.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Jan 21 10:59:09 UTC 2026 - Daniel Garcia + +- Add upstream patch pytest9.patch to make it compatible with pytest + 9.0, gh#freakboy3742/pytest-tldr@861b6a06575e + ------------------------------------------------------------------- Fri Jul 4 05:41:05 UTC 2025 - Steve Kowalik diff --git a/python-pytest-tldr.spec b/python-pytest-tldr.spec index 0f51e4a..986e73e 100644 --- a/python-pytest-tldr.spec +++ b/python-pytest-tldr.spec @@ -24,6 +24,8 @@ License: BSD-3-Clause URL: https://github.com/freakboy3742/pytest-tldr Source: https://files.pythonhosted.org/packages/source/p/pytest-tldr/pytest-tldr-%{version}.tar.gz Patch0: support-pytest-cov-6.patch +# PATCH-FIX-UPSTREAM pytest9.patch gh#freakboy3742/pytest-tldr@861b6a06575e +Patch1: pytest9.patch BuildRequires: %{python_module pip} BuildRequires: %{python_module pytest >= 3.5.0} BuildRequires: %{python_module pytest-cov}