python3-Twisted: update to 22.10.0.

This commit is contained in:
Joel Beckmeyer 2022-11-10 08:50:08 -05:00 committed by Michal Vasilek
parent 93d7cb3f9d
commit bc307b1d07
3 changed files with 295 additions and 4 deletions

View File

@ -0,0 +1,258 @@
From 4f6d7fb0749429b092fe7538a7d2b11fe58319a6 Mon Sep 17 00:00:00 2001
From: eevel <eevel@weezel3.weezelnet>
Date: Wed, 2 Nov 2022 20:35:55 -0500
Subject: [PATCH 02/12] fix twisted.persisted tests
---
src/twisted/persisted/aot.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/twisted/persisted/aot.py b/src/twisted/persisted/aot.py
index 0daeb3b4c85..204728058cd 100644
--- a/src/twisted/persisted/aot.py
+++ b/src/twisted/persisted/aot.py
@@ -399,8 +399,10 @@ def unjellyAO(self, ao):
inst = klass.__new__(klass)
if hasattr(klass, "__setstate__"):
self.callAfter(inst.__setstate__, state)
- else:
+ elif isinstance(state, dict):
inst.__dict__ = state
+ else:
+ inst.__dict__ = state.__getstate__()
return inst
elif c is Ref:
From 525377178adfa987ed56be753aec0fce35d721dc Mon Sep 17 00:00:00 2001
From: eevel <eevel@weezel3.weezelnet>
Date: Wed, 2 Nov 2022 21:35:58 -0500
Subject: [PATCH 03/12] fix tests for twisted.spread
---
src/twisted/spread/flavors.py | 2 ++
src/twisted/spread/jelly.py | 3 ++-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/twisted/spread/flavors.py b/src/twisted/spread/flavors.py
index 77c974195aa..a4fcd2126b6 100644
--- a/src/twisted/spread/flavors.py
+++ b/src/twisted/spread/flavors.py
@@ -398,6 +398,8 @@ def setCopyableState(self, state):
object's dictionary (or a filtered approximation of it depending
on my peer's perspective).
"""
+ if not state:
+ state = {}
state = {
x.decode("utf8") if isinstance(x, bytes) else x: y for x, y in state.items()
}
diff --git a/src/twisted/spread/jelly.py b/src/twisted/spread/jelly.py
index 7e1b4d254bd..46cda178448 100644
--- a/src/twisted/spread/jelly.py
+++ b/src/twisted/spread/jelly.py
@@ -154,7 +154,8 @@ def _newInstance(cls, state):
instance = _createBlank(cls)
def defaultSetter(state):
- instance.__dict__ = state
+ if isinstance(state, dict):
+ instance.__dict__ = state or {}
setter = getattr(instance, "__setstate__", defaultSetter)
setter(state)
From afcc224a02f72e5d12fa35d223bd753e8086b135 Mon Sep 17 00:00:00 2001
From: eevel <eevel@weezel3.weezelnet>
Date: Thu, 3 Nov 2022 21:12:31 -0500
Subject: [PATCH 04/12] fix test for twisted.web
---
src/twisted/web/test/test_flatten.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/twisted/web/test/test_flatten.py b/src/twisted/web/test/test_flatten.py
index e10eb06c22f..ad8c58576c3 100644
--- a/src/twisted/web/test/test_flatten.py
+++ b/src/twisted/web/test/test_flatten.py
@@ -706,9 +706,10 @@ def render(self, request: Optional[IRequest]) -> Flattenable:
Exception while flattening:
\\[<unrenderable>\\]
<unrenderable>
- .*
+ <Deferred at .* current result: <twisted.python.failure.Failure builtins.RuntimeError: example>>
File ".*", line \\d*, in _flattenTree
element = await element
+ .*
RuntimeError: example
"""
),
From 4b5ab38b09b326cec7967e04bd4cae8a84bb6784 Mon Sep 17 00:00:00 2001
From: eevel <eevel@weezel3.weezelnet>
Date: Thu, 3 Nov 2022 22:05:54 -0500
Subject: [PATCH 05/12] fix persisted tests in twisted.test
---
src/twisted/test/test_persisted.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/twisted/test/test_persisted.py b/src/twisted/test/test_persisted.py
index eedbbdac647..72354b33f38 100644
--- a/src/twisted/test/test_persisted.py
+++ b/src/twisted/test/test_persisted.py
@@ -378,6 +378,10 @@ class UnknownType:
def __dict__(self):
raise AttributeError()
+ @property
+ def __getstate__(self):
+ raise AttributeError()
+
self.assertRaises(TypeError, aot.jellyToSource, UnknownType())
def test_basicIdentity(self):
From f8f56d45113e5f2467a5e8375186e5db6309dfc6 Mon Sep 17 00:00:00 2001
From: eevel <eevel@weezel3.weezelnet>
Date: Thu, 3 Nov 2022 23:09:15 -0500
Subject: [PATCH 06/12] fix twisted.trial tests
---
src/twisted/trial/test/test_pyunitcompat.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/twisted/trial/test/test_pyunitcompat.py b/src/twisted/trial/test/test_pyunitcompat.py
index e8321c9cc6c..1ad4b5ebcf3 100644
--- a/src/twisted/trial/test/test_pyunitcompat.py
+++ b/src/twisted/trial/test/test_pyunitcompat.py
@@ -218,8 +218,10 @@ def test_tracebackFromCleanFailure(self):
pyresult = pyunit.TestResult()
result = PyUnitResultAdapter(pyresult)
result.addError(self, f)
+ tback = "".join(traceback.format_exception(*exc_info))
self.assertEqual(
- pyresult.errors[0][1], "".join(traceback.format_exception(*exc_info))
+ pyresult.errors[0][1].endswith("ZeroDivisionError: division by zero\n"),
+ tback.endswith("ZeroDivisionError: division by zero\n"),
)
def test_trialSkip(self):
From d91675ac5ffe907fcdbb3d1cedb1240008d81fd1 Mon Sep 17 00:00:00 2001
From: eevel <eevel@weezel3.weezelnet>
Date: Thu, 3 Nov 2022 23:15:55 -0500
Subject: [PATCH 07/12] make test_flatten backwards-compatible
---
src/twisted/web/test/test_flatten.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/twisted/web/test/test_flatten.py b/src/twisted/web/test/test_flatten.py
index ad8c58576c3..1070f767563 100644
--- a/src/twisted/web/test/test_flatten.py
+++ b/src/twisted/web/test/test_flatten.py
@@ -708,9 +708,7 @@ def render(self, request: Optional[IRequest]) -> Flattenable:
<unrenderable>
<Deferred at .* current result: <twisted.python.failure.Failure builtins.RuntimeError: example>>
File ".*", line \\d*, in _flattenTree
- element = await element
- .*
- RuntimeError: example
+ element = await element.*
"""
),
flags=re.MULTILINE,
From 603c61978ff18920ce7a133d9a0e5761ad8fcc19 Mon Sep 17 00:00:00 2001
From: eevel <eevel@weezel3.weezelnet>
Date: Thu, 3 Nov 2022 23:23:15 -0500
Subject: [PATCH 08/12] add newsfragment
---
src/twisted/newsfragments/10343.misc | 1 +
1 file changed, 1 insertion(+)
create mode 100644 src/twisted/newsfragments/10343.misc
diff --git a/src/twisted/newsfragments/10343.misc b/src/twisted/newsfragments/10343.misc
new file mode 100644
index 00000000000..3930e5bd729
--- /dev/null
+++ b/src/twisted/newsfragments/10343.misc
@@ -0,0 +1 @@
+Enable Python 3.11 for CI and fix the remaining broken tests.
From 800f9e9372b993356e22104d8295a89d4ee5fac4 Mon Sep 17 00:00:00 2001
From: eevel <eevel@weezel3.weezelnet>
Date: Fri, 4 Nov 2022 15:16:05 -0500
Subject: [PATCH 09/12] PR feedback
---
.github/workflows/test.yaml | 13 -------------
src/twisted/newsfragments/10343.feature | 1 +
src/twisted/newsfragments/10343.misc | 1 -
src/twisted/web/test/test_flatten.py | 1 +
4 files changed, 2 insertions(+), 14 deletions(-)
create mode 100644 src/twisted/newsfragments/10343.feature
delete mode 100644 src/twisted/newsfragments/10343.misc
@@ -1 +0,0 @@
-Enable Python 3.11 for CI and fix the remaining broken tests.
diff --git a/src/twisted/web/test/test_flatten.py b/src/twisted/web/test/test_flatten.py
index 1070f767563..ea6aa4a966a 100644
--- a/src/twisted/web/test/test_flatten.py
+++ b/src/twisted/web/test/test_flatten.py
@@ -714,6 +714,7 @@ def render(self, request: Optional[IRequest]) -> Flattenable:
flags=re.MULTILINE,
),
)
+ self.assertTrue('RuntimeError: example' in str(failure.value))
# The original exception is unmodified and will be logged separately if
# unhandled.
self.failureResultOf(failing, RuntimeError)
From 6b069e1de60d00b658c04b8d330ab399c912a6d7 Mon Sep 17 00:00:00 2001
From: eevel <eevel@weezel3.weezelnet>
Date: Fri, 4 Nov 2022 15:36:26 -0500
Subject: [PATCH 10/12] run linter
---
src/twisted/web/test/test_flatten.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/twisted/web/test/test_flatten.py b/src/twisted/web/test/test_flatten.py
index ea6aa4a966a..8c0d14be8f4 100644
--- a/src/twisted/web/test/test_flatten.py
+++ b/src/twisted/web/test/test_flatten.py
@@ -714,7 +714,7 @@ def render(self, request: Optional[IRequest]) -> Flattenable:
flags=re.MULTILINE,
),
)
- self.assertTrue('RuntimeError: example' in str(failure.value))
+ self.assertTrue("RuntimeError: example" in str(failure.value))
# The original exception is unmodified and will be logged separately if
# unhandled.
self.failureResultOf(failing, RuntimeError)
From fe8e9565e6dbcfea5258a69b098001ddd1479e4f Mon Sep 17 00:00:00 2001
From: eevel <eevel@weezel3.weezelnet>
Date: Fri, 4 Nov 2022 19:10:20 -0500
Subject: [PATCH 11/12] use assertIn vs assertTrue
---
src/twisted/web/test/test_flatten.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/twisted/web/test/test_flatten.py b/src/twisted/web/test/test_flatten.py
index 8c0d14be8f4..ad431312edb 100644
--- a/src/twisted/web/test/test_flatten.py
+++ b/src/twisted/web/test/test_flatten.py
@@ -714,7 +714,7 @@ def render(self, request: Optional[IRequest]) -> Flattenable:
flags=re.MULTILINE,
),
)
- self.assertTrue("RuntimeError: example" in str(failure.value))
+ self.assertIn("RuntimeError: example", str(failure.value))
# The original exception is unmodified and will be logged separately if
# unhandled.
self.failureResultOf(failing, RuntimeError)

View File

@ -0,0 +1,32 @@
From 00bf5be704bee022ba4d9b24eb6c2c768b4a1921 Mon Sep 17 00:00:00 2001
From: eevel <eevel@weezel3.weezelnet>
Date: Wed, 26 Oct 2022 19:49:33 -0500
Subject: [PATCH] fix sendmail tests for python 3.11
---
src/twisted/mail/test/test_smtp.py | 3 ++-
src/twisted/newsfragments/10345.misc | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
create mode 100644 src/twisted/newsfragments/10345.misc
diff --git a/src/twisted/mail/test/test_smtp.py b/src/twisted/mail/test/test_smtp.py
index 906eeaad410..4c1885935e4 100644
--- a/src/twisted/mail/test/test_smtp.py
+++ b/src/twisted/mail/test/test_smtp.py
@@ -1771,7 +1771,8 @@ def test_defaultReactorIsGlobalReactor(self):
The default C{reactor} parameter of L{twisted.mail.smtp.sendmail} is
L{twisted.internet.reactor}.
"""
- args, varArgs, keywords, defaults = inspect.getargspec(smtp.sendmail)
+ fullSpec = inspect.getfullargspec(smtp.sendmail)
+ defaults = fullSpec[3]
self.assertEqual(reactor, defaults[2])
def _honorsESMTPArguments(self, username, password):
diff --git a/src/twisted/newsfragments/10345.misc b/src/twisted/newsfragments/10345.misc
new file mode 100644
index 00000000000..2d51e2a7002
--- /dev/null
+++ b/src/twisted/newsfragments/10345.misc
@@ -0,0 +1 @@
+Fix SendmailTests for python 3.11.

View File

@ -1,7 +1,7 @@
# Template file for 'python3-Twisted' # Template file for 'python3-Twisted'
pkgname=python3-Twisted pkgname=python3-Twisted
version=22.1.0 version=22.10.0
revision=2 revision=1
build_style=python3-module build_style=python3-module
make_check_target=src/twisted make_check_target=src/twisted
hostmakedepends="python3-setuptools python3-incremental" hostmakedepends="python3-setuptools python3-incremental"
@ -10,14 +10,15 @@ depends="python3-zope.interface python3-constantly python3-incremental
python3-automat python3-hyperlink python3-attrs python3-typing_extensions python3-automat python3-hyperlink python3-attrs python3-typing_extensions
python3-openssl python3-service_identity python3-pyasn1" python3-openssl python3-service_identity python3-pyasn1"
checkdepends="python3-bcrypt python3-PyHamcrest git python3-h2 checkdepends="python3-bcrypt python3-PyHamcrest git python3-h2
python3-hyperframe python3-priority python3-hpack python3-appdirs $depends" python3-hyperframe python3-priority python3-hpack python3-appdirs
python3-hypothesis $depends"
short_desc="Asynchronous networking framework written in Python (Python3)" short_desc="Asynchronous networking framework written in Python (Python3)"
maintainer="Orphaned <orphan@voidlinux.org>" maintainer="Orphaned <orphan@voidlinux.org>"
license="MIT" license="MIT"
homepage="https://twistedmatrix.com/" homepage="https://twistedmatrix.com/"
changelog="https://raw.githubusercontent.com/twisted/twisted/trunk/NEWS.rst" changelog="https://raw.githubusercontent.com/twisted/twisted/trunk/NEWS.rst"
distfiles="${PYPI_SITE}/T/Twisted/Twisted-${version}.tar.gz" distfiles="${PYPI_SITE}/T/Twisted/Twisted-${version}.tar.gz"
checksum=b7971ec9805b0f80e1dcb1a3721d7bfad636d5f909de687430ce373979d67b61 checksum=32acbd40a94f5f46e7b42c109bfae2b302250945561783a8b7a059048f2d4d31
make_check=ci-skip # some tests fail when running as root make_check=ci-skip # some tests fail when running as root
alternatives=" alternatives="