Make it compatible with pytest 9.0

Add upstream patch drop-pytest6-support.patch,
gh#Teemu/pytest-sugar@05a1e912fd9f
This commit is contained in:
2026-01-21 11:41:24 +01:00
parent 8c02279493
commit 9a3029b5c8
3 changed files with 68 additions and 1 deletions

View File

@@ -0,0 +1,59 @@
From 05a1e912fd9f257f30709c7b56dfeef3079e1408 Mon Sep 17 00:00:00 2001
From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Date: Fri, 12 Dec 2025 14:58:47 +0200
Subject: [PATCH] Drop support for pytest 6
---
.github/workflows/build-and-test.yaml | 4 ++--
README.md | 2 +-
pyproject.toml | 2 +-
pytest_sugar.py | 6 +-----
setup.py | 2 +-
test_sugar.py | 8 ++------
tox.ini | 2 +-
7 files changed, 9 insertions(+), 17 deletions(-)
Index: pytest-sugar-1.1.1/pytest_sugar.py
===================================================================
--- pytest-sugar-1.1.1.orig/pytest_sugar.py
+++ pytest-sugar-1.1.1/pytest_sugar.py
@@ -287,12 +287,8 @@ class SugarTerminalReporter(TerminalRepo
),
bold=True,
)
- if int(pytest.__version__.split(".")[0]) <= 6:
- hook_call_kwargs = {"startdir": self.startpath}
- else:
- hook_call_kwargs = {"start_path": self.startpath}
lines = self.config.hook.pytest_report_header(
- config=self.config, **hook_call_kwargs
+ config=self.config, start_path=self.startpath
)
lines.reverse()
for line in flatten(lines):
Index: pytest-sugar-1.1.1/setup.py
===================================================================
--- pytest-sugar-1.1.1.orig/setup.py
+++ pytest-sugar-1.1.1/setup.py
@@ -41,7 +41,7 @@ setup(
zip_safe=False,
include_package_data=True,
platforms="any",
- install_requires=["pytest>=6.2.0", "termcolor>=2.1.0"],
+ install_requires=["pytest>=7", "termcolor>=2.1.0"],
extras_require={
"dev": [
"black",
Index: pytest-sugar-1.1.1/test_sugar.py
===================================================================
--- pytest-sugar-1.1.1.orig/test_sugar.py
+++ pytest-sugar-1.1.1/test_sugar.py
@@ -114,7 +114,7 @@ class TestTerminalReporter:
def test_report_header(self, testdir):
testdir.makeconftest(
"""
- def pytest_report_header(startdir):
+ def pytest_report_header(start_path):
pass
"""
)

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Jan 21 10:40:25 UTC 2026 - Daniel Garcia <daniel.garcia@suse.com>
- Make it compatible with pytest 9.0. Add upstream patch
drop-pytest6-support.patch, gh#Teemu/pytest-sugar@05a1e912fd9f
-------------------------------------------------------------------
Sun Sep 14 18:27:57 UTC 2025 - Dirk Müller <dmueller@suse.com>

View File

@@ -24,6 +24,8 @@ Summary: Pretty printer for pytest progress
License: BSD-3-Clause
URL: https://github.com/Frozenball/pytest-sugar
Source: https://files.pythonhosted.org/packages/source/p/pytest-sugar/pytest-sugar-%{version}.tar.gz
# PATCH-FIX-UPSTREAM: drop-pytest6-support.patch gh#Teemu/pytest-sugar@05a1e912fd9f
Patch0: drop-pytest6-support.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
@@ -40,7 +42,7 @@ BuildArch: noarch
pytest-sugar is a plugin for py.test that shows failures and errors instantly and shows a progress bar.
%prep
%setup -q -n pytest-sugar-%{version}
%autosetup -p1 -n pytest-sugar-%{version}
%build
%pyproject_wheel