15
0

Accepting request 1294655 from devel:languages:python

- Update URL.
- Add patch support-click-8.2.patch:
  * Support Click 8.2+ changes.
- Add patch fix-cli-test-fails-with-yes.patch:
  * Invoke ourselves with --yes to avoid interactive prompts.

OBS-URL: https://build.opensuse.org/request/show/1294655
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-towncrier?expand=0&rev=6
This commit is contained in:
2025-07-21 17:59:47 +00:00
committed by Git OBS Bridge
4 changed files with 101 additions and 3 deletions

View File

@@ -0,0 +1,50 @@
From de71f131cd845ba76ae288292d7c3338716b82fd Mon Sep 17 00:00:00 2001
From: Firas AlShafei <f.alshafei@gmail.com>
Date: Thu, 22 May 2025 21:20:19 -0500
Subject: [PATCH] ci: add --yes flag to build tests to prevent interactive
prompt failures
---
src/towncrier/test/test_build.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
Index: towncrier-24.8.0/src/towncrier/test/test_build.py
===================================================================
--- towncrier-24.8.0.orig/src/towncrier/test/test_build.py
+++ towncrier-24.8.0/src/towncrier/test/test_build.py
@@ -1143,7 +1143,7 @@ class TestCli(TestCase):
),
)
- result = runner.invoke(_main, ["--date", "01-01-2001"], catch_exceptions=False)
+ result = runner.invoke(_main, ["--date", "01-01-2001", "--yes"], catch_exceptions=False)
with open("foo/newsfragments/123.feature", "w") as f:
f.write("Adds levitation")
@@ -1319,7 +1319,7 @@ class TestCli(TestCase):
dedent=True,
)
- result = runner.invoke(_main, ["--date", "01-01-2001"], catch_exceptions=False)
+ result = runner.invoke(_main, ["--date", "01-01-2001", "--yes"], catch_exceptions=False)
self.assertEqual(0, result.exit_code, result.output)
output = read("NEWS.rst")
@@ -1373,7 +1373,7 @@ class TestCli(TestCase):
dedent=True,
)
- result = runner.invoke(_main, ["--date", "01-01-2001"], catch_exceptions=False)
+ result = runner.invoke(_main, ["--date", "01-01-2001", "--yes"], catch_exceptions=False)
self.assertEqual(0, result.exit_code, result.output)
output = read("NEWS.md")
@@ -1425,7 +1425,7 @@ class TestCli(TestCase):
dedent=True,
)
- result = runner.invoke(_main, ["--date", "01-01-2001"], catch_exceptions=False)
+ result = runner.invoke(_main, ["--date", "01-01-2001", "--yes"], catch_exceptions=False)
self.assertEqual(0, result.exit_code, result.output)
output = read("NEWS.md")

View File

@@ -1,3 +1,12 @@
-------------------------------------------------------------------
Mon Jul 21 04:35:04 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
- Update URL.
- Add patch support-click-8.2.patch:
* Support Click 8.2+ changes.
- Add patch fix-cli-test-fails-with-yes.patch:
* Invoke ourselves with --yes to avoid interactive prompts.
-------------------------------------------------------------------
Tue Apr 8 11:25:44 UTC 2025 - Ben Greiner <code@bnavigator.de>

View File

@@ -22,9 +22,12 @@ Version: 24.8.0
Release: 0
Summary: Building newsfiles for your project
License: MIT
Group: Development/Languages/Python
URL: https://github.com/hawkowl/towncrier
URL: https://github.com/twisted/towncrier
Source: https://files.pythonhosted.org/packages/source/t/towncrier/towncrier-%{version}.tar.gz
# PATCH-FIX-UPSTREAM Based on gh#twisted/towncrier#709/commits/2fee0e7f103161175424867c9716339a196bc957
Patch0: support-click-8.2.patch
# PATCH-FIX-UPSTREAM Based on gh#twisted/towncrier#709/commits/de71f131cd845ba76ae288292d7c3338716b82fd
Patch1: fix-cli-test-fails-with-yes.patch
BuildRequires: %{python_module Jinja2}
BuildRequires: %{python_module click}
BuildRequires: %{python_module hatchling}
@@ -58,7 +61,7 @@ BuildRequires: %{python_module pytest}
Building newsfiles for your project.
%prep
%setup -q -n towncrier-%{version}
%autosetup -p1 -n towncrier-%{version}
%build
%pyproject_wheel

36
support-click-8.2.patch Normal file
View File

@@ -0,0 +1,36 @@
From 2fee0e7f103161175424867c9716339a196bc957 Mon Sep 17 00:00:00 2001
From: Firas AlShafei <f.alshafei@gmail.com>
Date: Thu, 22 May 2025 21:17:15 -0500
Subject: [PATCH] ci: fix clirunner
- Adapt CliRunner for different Click library versions to correctly handle error messages.
---
src/towncrier/test/test_check.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Index: towncrier-24.8.0/src/towncrier/test/test_check.py
===================================================================
--- towncrier-24.8.0.orig/src/towncrier/test/test_check.py
+++ towncrier-24.8.0/src/towncrier/test/test_check.py
@@ -245,7 +245,12 @@ class TestChecker(TestCase):
"""
No failure when output is piped causing None encoding for stdout.
"""
- runner = CliRunner()
+ try:
+ runner = CliRunner(mix_stderr=False)
+ except TypeError:
+ # Fallback for older Click versions (or unexpected signature)
+ print("TypeError with mix_stderr=False, falling back to echo_stdin=True")
+ runner = CliRunner(echo_stdin=True)
with runner.isolated_filesystem():
create_project("pyproject.toml", main_branch="master")
@@ -257,7 +262,6 @@ class TestChecker(TestCase):
call(["git", "add", fragment_path])
call(["git", "commit", "-m", "add a newsfragment"])
- runner = CliRunner(mix_stderr=False)
result = runner.invoke(towncrier_check, ["--compare-with", "master"])
self.assertEqual(0, result.exit_code)