1
0

Accepting request 986543 from devel:languages:python:mailman

- Add hyperkitty-fix-py310-tests.patch
  * Fix test failures on Python 3.10 (and Python 3.9.13)
  * https://gitlab.com/mailman/hyperkitty/-/issues/401
  * https://gitlab.com/mailman/hyperkitty/-/merge_requests/381
  * https://gitlab.com/mailman/hyperkitty/-/merge_requests/449
- Fix django warning that timeout is bigger than retry
  * Added hyperkitty-fix-qcluster-timeout.patch

OBS-URL: https://build.opensuse.org/request/show/986543
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-HyperKitty?expand=0&rev=17
This commit is contained in:
2022-07-04 09:32:38 +00:00
committed by Git OBS Bridge
5 changed files with 149 additions and 0 deletions

View File

@@ -0,0 +1,102 @@
From 2cda594bc0e7af5c0c24dcc3467ecea04be89f9e Mon Sep 17 00:00:00 2001
From: David Runge <dave@sleepmap.de>
Date: Tue, 7 Dec 2021 22:46:17 +0100
Subject: [PATCH 1/4] Ensure that date headers are valid
hyperkitty/management/commands/hyperkitty_import.py:
Change `DbImporter._get_date()` to return None if a `Date:` header is
retrieved, that is not valid (its `datetime` attribute is set to
`None`).
The email module has been reworked with python 3.10 to set the `Date:`
header string representation even if it is not valid, but ensures, that
its `datetime` attribute is set to None in that case:
https://github.com/python/cpython/commit/303aac8c56609290e122eecc14c038e9b1e4174a
hyperkitty/tests/commands/test_import.py:
Change `test_ungettable_date()` to rely on differing error messages in
the output, depending on python version. With python 3.10 the logged
error message has changed.
---
hyperkitty/management/commands/hyperkitty_import.py | 9 ++++++++-
hyperkitty/tests/commands/test_import.py | 7 ++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
Index: HyperKitty-1.3.5/hyperkitty/management/commands/hyperkitty_import.py
===================================================================
--- HyperKitty-1.3.5.orig/hyperkitty/management/commands/hyperkitty_import.py
+++ HyperKitty-1.3.5/hyperkitty/management/commands/hyperkitty_import.py
@@ -131,7 +131,14 @@ class DbImporter(object):
def _get_date(self, message, header, report_name):
try:
date = message.get(header)
- except (TypeError, ValueError) as e:
+ if date and not date.datetime:
+ if self.verbose:
+ self.stderr.write(
+ "Bad datetime in {} header in message {}{}.".format(
+ header, unquote(message.get("message-id", 'n/a')),
+ report_name))
+ return None
+ except (AttributeError, TypeError, ValueError) as e:
if self.verbose:
self.stderr.write(
"Can't get {} header in message {}{}: {}.".format(
Index: HyperKitty-1.3.5/hyperkitty/tests/commands/test_import.py
===================================================================
--- HyperKitty-1.3.5.orig/hyperkitty/tests/commands/test_import.py
+++ HyperKitty-1.3.5/hyperkitty/tests/commands/test_import.py
@@ -225,7 +225,12 @@ msg1
# The message should be archived.
self.assertEqual(Email.objects.count(), 1)
# But there should be an error message.
- self.assertIn("Can't get date header in message", output.getvalue())
+ if sys.hexversion < 0x30a0000:
+ self.assertIn("Can't get date header in message",
+ output.getvalue())
+ else:
+ self.assertIn("Bad datetime in date header in message",
+ output.getvalue())
def test_no_date_but_resent_date(self):
# If there's no Dete: header, fall back to Resent-Date:.
Index: HyperKitty-1.3.5/tox.ini
===================================================================
--- HyperKitty-1.3.5.orig/tox.ini
+++ HyperKitty-1.3.5/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = py{36,37,38,39}-django{22,30,31,32},docs,qa
+envlist = py{36,37,38,39,310}-django{22,30,31,32},docs,qa
[testenv]
From 3efe7507944dbdbfcfa4c182d332528712476b28 Mon Sep 17 00:00:00 2001
From: Mark Sapiro <mark@msapiro.net>
Date: Thu, 16 Jun 2022 13:40:28 -0700
Subject: [PATCH] Skip test_import.test_unconvertable_message where bpo-43323
is fixed.
---
hyperkitty/tests/commands/test_import.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hyperkitty/tests/commands/test_import.py b/hyperkitty/tests/commands/test_import.py
index 5284e0a8..c9c288bd 100644
--- a/hyperkitty/tests/commands/test_import.py
+++ b/hyperkitty/tests/commands/test_import.py
@@ -364,6 +364,11 @@ msg1
def test_unconvertable_message(self):
# This message can't be converted to an email.message.EmailMessage.
+ # This fails with Python 3.9 >=3.9.13 and versions >= 3.10.5 because
+ # https://bugs.python.org/issue43323 is fixed.
+ if ((sys.hexversion >= 0x3090df0 and sys.hexversion < 0x30a0000) or
+ sys.hexversion >= 0x30a05f0):
+ raise SkipTest
mbox = mailbox.mbox(os.path.join(self.tmpdir, "test.mbox"))
# We have to do it this way to see the exception.
with open(get_test_file("unconvertable_message.txt"), "rb") as em_file:
--
GitLab

View File

@@ -0,0 +1,24 @@
From 3edc0c58b8dea3b0bdccd77c0794ada28d1c6f61 Mon Sep 17 00:00:00 2001
From: Mark Sapiro <mark@msapiro.net>
Date: Sun, 5 Dec 2021 00:32:33 +0000
Subject: [PATCH] Set Q_CLUSTER retry > timeout.
---
example_project/settings.py | 1 +
1 files changed, 1 insertions(+)
diff --git a/example_project/settings.py b/example_project/settings.py
index a6e90441..5aca0186 100644
--- a/example_project/settings.py
+++ b/example_project/settings.py
@@ -368,6 +368,7 @@ REST_FRAMEWORK = {
#
Q_CLUSTER = {
'timeout': 300,
+ 'retry': 360,
'save_limit': 100,
'orm': 'default',
}
--
GitLab

View File

@@ -1,3 +1,5 @@
addFilter("zero-length")
addFilter("non-standard-gid")
addFilter("non-standard-uid")
addFilter("spurious-executable-perm .*example_project/wsgi.py")
addFilter("hidden-file-or-dir .*example_project/logs/.keep")

View File

@@ -1,3 +1,18 @@
-------------------------------------------------------------------
Sun Jul 3 20:46:20 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Add hyperkitty-fix-py310-tests.patch
* Fix test failures on Python 3.10 (and Python 3.9.13)
* https://gitlab.com/mailman/hyperkitty/-/issues/401
* https://gitlab.com/mailman/hyperkitty/-/merge_requests/381
* https://gitlab.com/mailman/hyperkitty/-/merge_requests/449
-------------------------------------------------------------------
Sat Jul 2 06:12:09 UTC 2022 - Andreas Schneider <asn@cryptomilk.org>
- Fix django warning that timeout is bigger than retry
* Added hyperkitty-fix-qcluster-timeout.patch
-------------------------------------------------------------------
Fri Jun 10 08:14:18 UTC 2022 - Andreas Schneider <asn@cryptomilk.org>

View File

@@ -63,6 +63,10 @@ Patch1: hyperkitty-fix-mistune-2.0-imports.patch
Patch2: hyperkitty-django4.patch
# https://gitlab.com/mailman/hyperkitty/-/issues/429
Patch3: python-HyperKitty-no-mock.patch
# https://gitlab.com/mailman/hyperkitty/-/commit/3edc0c58b8dea3b0bdccd77c0794ada28d1c6f61
Patch4: hyperkitty-fix-qcluster-timeout.patch
# https://gitlab.com/mailman/hyperkitty/-/merge_requests/381 + https://gitlab.com/mailman/hyperkitty/-/merge_requests/449
Patch5: hyperkitty-fix-py310-tests.patch
#
BuildRequires: %{python_module django-debug-toolbar >= 2.2}
BuildRequires: %{python_module isort}
@@ -162,6 +166,8 @@ rsync -a example_project/* build_static_files
%patch0 -p1
%patch1 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%build
sed -i 's|^#!/usr/bin/env.*|#!%{_bindir}/python3|' \