Require click >=8.0.0

This commit is contained in:
wang--ge 2022-10-28 10:53:38 +08:00
parent 19167c5039
commit 845c510d40
3 changed files with 113 additions and 115 deletions

View File

@ -1,112 +0,0 @@
From 3b8f0a3c4981f61d2f9b759b27a1e4b3c1d504aa Mon Sep 17 00:00:00 2001
From: baizg1107 <preloyalwhite@163.com>
Date: Mon, 20 Jun 2022 11:33:30 +0800
Subject: [PATCH] fix tests assertion error
---
src/mailman/commands/tests/test_cli_addmembers.py | 1 +
src/mailman/commands/tests/test_cli_delmembers.py | 1 +
src/mailman/commands/tests/test_cli_notify.py | 7 +++----
src/mailman/commands/tests/test_cli_syncmembers.py | 12 ++++++------
src/mailman/model/tests/test_listmanager.py | 12 ++++++------
5 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/src/mailman/commands/tests/test_cli_addmembers.py b/src/mailman/commands/tests/test_cli_addmembers.py
index 13f6ff7..6c87b9d 100644
--- a/src/mailman/commands/tests/test_cli_addmembers.py
+++ b/src/mailman/commands/tests/test_cli_addmembers.py
@@ -253,6 +253,7 @@ class TestCLIAddMembers(unittest.TestCase):
print('Anne Person <aperson@example.com>', file=infp)
result = self._command.invoke(addmembers, (
'-i', infp.name, 'ant.example.com'))
+ self.maxDiff = None
self.assertEqual(result.output, '')
self.assertEqual(result.exit_code, 0)
members = list(self._mlist.members.members)
diff --git a/src/mailman/commands/tests/test_cli_delmembers.py b/src/mailman/commands/tests/test_cli_delmembers.py
index 297e0bf..091c134 100644
--- a/src/mailman/commands/tests/test_cli_delmembers.py
+++ b/src/mailman/commands/tests/test_cli_delmembers.py
@@ -143,6 +143,7 @@ class TestCLIDelMembers(unittest.TestCase):
print('Bart Person <bperson@example.com>', file=infp)
result = self._command.invoke(delmembers, (
'--fromall', '-f', infp.name))
+ self.maxDiff = None
self.assertEqual(result.output, '')
members = list(self._mlist.members.members)
self.assertEqual(len(members), 1)
diff --git a/src/mailman/commands/tests/test_cli_notify.py b/src/mailman/commands/tests/test_cli_notify.py
index 8b37922..30b4518 100644
--- a/src/mailman/commands/tests/test_cli_notify.py
+++ b/src/mailman/commands/tests/test_cli_notify.py
@@ -134,10 +134,9 @@ No such list found: bogus@example.com
# Clear messages from setup.
get_queue_messages('virgin')
result = self._command.invoke(notify, ('-v',))
- self.assertMultiLineEqual(result.output, """\
-The ant@example.com list has 4 moderation requests waiting.
-The bee@example.com list has 0 moderation requests waiting.
-""")
+ self.maxDiff = None
+ equaldiff = result.output
+ self.assertMultiLineEqual(result.output, equaldiff)
msg = get_queue_messages('virgin', expected_count=1)[0].msg
self.assertMultiLineEqual(msg.get_payload(), """\
The ant@example.com list has 4 moderation requests waiting.
diff --git a/src/mailman/commands/tests/test_cli_syncmembers.py b/src/mailman/commands/tests/test_cli_syncmembers.py
index 3a30bbf..6dc46b0 100644
--- a/src/mailman/commands/tests/test_cli_syncmembers.py
+++ b/src/mailman/commands/tests/test_cli_syncmembers.py
@@ -106,11 +106,10 @@ class TestCLISyncMembers(unittest.TestCase):
print('Anne Person <aperson@example.com>', file=infp)
result = self._command.invoke(syncmembers, (
infp.name, 'ant.example.com'))
+ self.maxDiff = None
+ equaldiff = result.output
self.assertEqual(
- result.output,
- '[ADD] Anne Person <aperson@example.com>\n'
- 'Membership is banned (skipping): '
- 'Anne Person <aperson@example.com>\n'
+ result.output, equaldiff
)
self.assertEqual(len(list(self._mlist.members.members)), 0)
@@ -413,8 +412,9 @@ class TestCLISyncMembers(unittest.TestCase):
print('Anne Person <aperson@example.com>', file=infp)
result = self._command.invoke(syncmembers, (
infp.name, 'ant.example.com'))
- self.assertEqual(result.output,
- '[ADD] Anne Person <aperson@example.com>\n')
+ self.assertEqual(result.exit_code, 0)
+ equaldiff = result.output
+ self.assertEqual(result.output, equaldiff)
self.assertEqual(result.exit_code, 0)
members = list(self._mlist.members.members)
self.assertEqual(len(members), 1)
diff --git a/src/mailman/model/tests/test_listmanager.py b/src/mailman/model/tests/test_listmanager.py
index 8e0ba03..82f8427 100644
--- a/src/mailman/model/tests/test_listmanager.py
+++ b/src/mailman/model/tests/test_listmanager.py
@@ -81,12 +81,12 @@ class TestListManager(unittest.TestCase):
def test_list_manager_list_ids(self):
# You can get all the list ids for all the existing mailing lists.
- create_list('ant@example.com')
- create_list('bee@example.com')
- create_list('cat@example.com')
- self.assertEqual(
- sorted(getUtility(IListManager).list_ids),
- ['ant.example.com', 'bee.example.com', 'cat.example.com'])
+ ant = create_list('ant@example.com')
+ bee = create_list('bee@example.com')
+ cat = create_list('cat@example.com')
+ self.assertEqual(ant.list_id, 'ant.example.com')
+ self.assertEqual(bee.list_id, 'bee.example.com')
+ self.assertEqual(cat.list_id, 'cat.example.com')
def test_delete_list_with_list_archiver_set(self):
# Ensure that mailing lists with archiver sets can be deleted. In
--
2.27.0

View File

@ -7,7 +7,7 @@
Name: mailman
Version: 3.3.2
Release: 6
Release: 7
Epoch: 3
Summary: The GNU mailing list manager
License: GPLv3
@ -19,12 +19,13 @@ Source3: mailman3.service
Source4: mailman3.logrotate
Source5: mailman3-digests.service
Source6: mailman3-digests.timer
#Refer: https://gitlab.com/mailman/mailman/-/merge_requests/860
Patch01: mailman3-click8.patch
Patch11: mailman-subject-prefix.patch
Patch14: mailman-use-either-importlib_resources-or-directly-importlib.patch
Patch15: fixbuilderror-1.patch
Patch16: fixbuilderror-2.patch
Patch17: CVE-2021-34337.patch
Patch18: 0001-fix-tests-assertion-error.patch
BuildArch: noarch
BuildRequires: glibc-langpack-en
BuildRequires: python%{python3_pkgversion}-devel >= 3.5 python%{python3_pkgversion}-setuptools
@ -34,7 +35,7 @@ Requires: python%{python3_pkgversion}-aiosmtpd >= 1.1 python%{python3
Requires: python%{python3_pkgversion}-atpublic
Requires: python%{python3_pkgversion}-authheaders >= 0.9.2
Requires: python%{python3_pkgversion}-authres >= 1.0.1
Requires: python%{python3_pkgversion}-click >= 7.0
Requires: python%{python3_pkgversion}-click >= 8.0
Requires: python%{python3_pkgversion}-dateutil >= 2.0
Requires: python%{python3_pkgversion}-dns >= 1.14.0
Requires: python%{python3_pkgversion}-falcon >= 1.0.0
@ -206,6 +207,8 @@ done
%{_datadir}/selinux/*/mailman3.pp
%changelog
* Fri Oct 28 2022 Ge Wang <wangge20@h-partners.com> - 3:3.3.2-7
- Require click >= 8.0 and fix the tests it breaks
* Thu Oct 27 2022 xu_ping <xuping33@h-partners.com> - 3:3.3.2-6
- fix tests assertion error

107
mailman3-click8.patch Normal file
View File

@ -0,0 +1,107 @@
From 465c2ff847d462c1a9cf8f548093ba4b5be84c3b Mon Sep 17 00:00:00 2001
From: Mark Sapiro <mark@msapiro.net>
Date: Tue, 11 May 2021 18:14:59 -0700
Subject: [PATCH] Require click >=8.0.0 and fix the tests it breaks.
---
setup.py | 2 +-
src/mailman/commands/docs/import.rst | 1 +
src/mailman/commands/tests/test_cli_addmembers.py | 8 ++++----
src/mailman/commands/tests/test_cli_delmembers.py | 4 ++--
src/mailman/commands/tests/test_cli_syncmembers.py | 8 ++++----
5 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/setup.py b/setup.py
index cd36456..ad04e77 100644
--- a/setup.py
+++ b/setup.py
@@ -115,7 +115,7 @@ case second 'm'. Any other spelling is incorrect.""",
'atpublic',
'authheaders>=0.9.2',
'authres>=1.0.1',
- 'click>=7.0.0',
+ 'click>=8.0.0',
'dnspython>=1.14.0',
'falcon>1.0.0',
'flufl.bounce',
diff --git a/src/mailman/commands/docs/import.rst b/src/mailman/commands/docs/import.rst
index 947d932..66f72be 100644
--- a/src/mailman/commands/docs/import.rst
+++ b/src/mailman/commands/docs/import.rst
@@ -58,5 +58,6 @@ import, the mailing list's "real name" will change.
Import
>>> command('mailman import21 import@example.com ' + pickle_file)
+ Importing ...
>>> print(mlist.display_name)
Test
diff --git a/src/mailman/commands/tests/test_cli_addmembers.py b/src/mailman/commands/tests/test_cli_addmembers.py
index e257da5..95f8542 100644
--- a/src/mailman/commands/tests/test_cli_addmembers.py
+++ b/src/mailman/commands/tests/test_cli_addmembers.py
@@ -57,8 +57,8 @@ class TestCLIAddMembers(unittest.TestCase):
result.output,
'Usage: addmembers [OPTIONS] FILENAME LISTSPEC\n'
'Try \'addmembers --help\' for help.\n\n'
- 'Error: Invalid value for \'FILENAME\': Could not open '
- 'file: bad: No such file or directory\n')
+ 'Error: Invalid value for \'FILENAME\': '
+ '\'bad\': No such file or directory\n')
def test_already_subscribed_with_display_name(self):
subscribe(self._mlist, 'Anne')
@@ -265,8 +265,8 @@ class TestCLIAddMembers(unittest.TestCase):
'Usage: addmembers [OPTIONS] FILENAME LISTSPEC\n'
'Try \'addmembers --help\' for help.\n\n'
'Error: Invalid value for \'--delivery\' / \'-d\': '
- 'invalid choice: bogus. (choose from regular, mime, '
- 'plain, summary, disabled)\n')
+ '\'bogus\' is not one of \'regular\', \'mime\', '
+ '\'plain\', \'summary\', \'disabled\'.\n')
def test_invite_member(self):
with NamedTemporaryFile('w', buffering=1, encoding='utf-8') as infp:
diff --git a/src/mailman/commands/tests/test_cli_delmembers.py b/src/mailman/commands/tests/test_cli_delmembers.py
index cf24b54..e34c22a 100644
--- a/src/mailman/commands/tests/test_cli_delmembers.py
+++ b/src/mailman/commands/tests/test_cli_delmembers.py
@@ -56,8 +56,8 @@ class TestCLIDelMembers(unittest.TestCase):
result.output,
'Usage: delmembers [OPTIONS]\n'
'Try \'delmembers --help\' for help.\n\n'
- 'Error: Invalid value for \'--file\' / \'-f\': Could not open '
- 'file: bad: No such file or directory\n')
+ 'Error: Invalid value for \'--file\' / \'-f\': '
+ '\'bad\': No such file or directory\n')
def test_not_subscribed_without_display_name(self):
with NamedTemporaryFile('w', buffering=1, encoding='utf-8') as infp:
diff --git a/src/mailman/commands/tests/test_cli_syncmembers.py b/src/mailman/commands/tests/test_cli_syncmembers.py
index 658b867..faed507 100644
--- a/src/mailman/commands/tests/test_cli_syncmembers.py
+++ b/src/mailman/commands/tests/test_cli_syncmembers.py
@@ -58,8 +58,8 @@ class TestCLISyncMembers(unittest.TestCase):
result.output,
'Usage: syncmembers [OPTIONS] FILENAME LISTSPEC\n'
'Try \'syncmembers --help\' for help.\n\n'
- 'Error: Invalid value for \'FILENAME\': Could not open '
- 'file: bad: No such file or directory\n')
+ 'Error: Invalid value for \'FILENAME\': '
+ '\'bad\': No such file or directory\n')
def test_sync_invalid_email(self):
with NamedTemporaryFile('w', buffering=1, encoding='utf-8') as infp:
@@ -374,8 +374,8 @@ class TestCLISyncMembers(unittest.TestCase):
'Usage: syncmembers [OPTIONS] FILENAME LISTSPEC\n'
'Try \'syncmembers --help\' for help.\n\n'
'Error: Invalid value for \'--delivery\' / \'-d\': '
- 'invalid choice: bogus. (choose from regular, mime, '
- 'plain, summary, disabled)\n')
+ '\'bogus\' is not one of \'regular\', \'mime\', '
+ '\'plain\', \'summary\', \'disabled\'.\n')
def test_override_no_welcome(self):
self._mlist.send_welcome_message = False
--
2.32.0