forked from pool/python-pytest-tldr
Compare commits
5 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
| 126aa04c9c | |||
| 407389cd3c | |||
| b997e2db2a | |||
| 120172a658 | |||
| 9f46a87049 |
139
pytest9.patch
Normal file
139
pytest9.patch
Normal file
@@ -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 <kweihmann@outlook.com>
|
||||||
|
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
|
||||||
|
---
|
||||||
|
.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
|
||||||
@@ -1,3 +1,20 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jan 21 10:59:09 UTC 2026 - Daniel Garcia <daniel.garcia@suse.com>
|
||||||
|
|
||||||
|
- 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 <steven.kowalik@suse.com>
|
||||||
|
|
||||||
|
- Add patch support-pytest-cov-6.patch:
|
||||||
|
* Support pytest output change.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed May 7 06:59:51 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
|
||||||
|
|
||||||
|
- Switch to pyproject macros.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Nov 30 11:56:24 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>
|
Wed Nov 30 11:56:24 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-pytest-tldr
|
# spec file for package python-pytest-tldr
|
||||||
#
|
#
|
||||||
# Copyright (c) 2022 SUSE LLC
|
# Copyright (c) 2025 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@@ -21,12 +21,16 @@ Version: 0.2.5
|
|||||||
Release: 0
|
Release: 0
|
||||||
Summary: A pytest plugin that limits the output to just the things you need
|
Summary: A pytest plugin that limits the output to just the things you need
|
||||||
License: BSD-3-Clause
|
License: BSD-3-Clause
|
||||||
Group: Development/Languages/Python
|
|
||||||
URL: https://github.com/freakboy3742/pytest-tldr
|
URL: https://github.com/freakboy3742/pytest-tldr
|
||||||
Source: https://files.pythonhosted.org/packages/source/p/pytest-tldr/pytest-tldr-%{version}.tar.gz
|
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 >= 3.5.0}
|
||||||
BuildRequires: %{python_module pytest-cov}
|
BuildRequires: %{python_module pytest-cov}
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
|
BuildRequires: %{python_module wheel}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
Requires: python-pytest >= 3.5.0
|
Requires: python-pytest >= 3.5.0
|
||||||
@@ -37,13 +41,13 @@ BuildArch: noarch
|
|||||||
A pytest plugin that limits the output to just the things you need.
|
A pytest plugin that limits the output to just the things you need.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n pytest-tldr-%{version}
|
%autosetup -p1 -n pytest-tldr-%{version}
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%pyproject_wheel
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%python_install
|
%pyproject_install
|
||||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||||
|
|
||||||
%check
|
%check
|
||||||
@@ -52,8 +56,8 @@ A pytest plugin that limits the output to just the things you need.
|
|||||||
%files %{python_files}
|
%files %{python_files}
|
||||||
%doc README.rst
|
%doc README.rst
|
||||||
%license LICENSE
|
%license LICENSE
|
||||||
%pycache_only %{python_sitelib}/__pycache__/*.pyc
|
%pycache_only %{python_sitelib}/__pycache__/pytest_tldr.*.pyc
|
||||||
%{python_sitelib}/pytest_tldr.py
|
%{python_sitelib}/pytest_tldr.py
|
||||||
%{python_sitelib}/pytest_tldr-%{version}*-info
|
%{python_sitelib}/pytest_tldr-%{version}.dist-info
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
|||||||
13
support-pytest-cov-6.patch
Normal file
13
support-pytest-cov-6.patch
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
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%",
|
||||||
Reference in New Issue
Block a user