You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
287 lines
9.2 KiB
287 lines
9.2 KiB
From e5473d7575dfe12c43fa0cc9ca80df22b276742f Mon Sep 17 00:00:00 2001
|
|
From: eevelweezel <eevel.weezel@gmail.com>
|
|
Date: Wed, 24 Jan 2024 22:00:31 -0600
|
|
Subject: [PATCH 1/4] fix inlinecb tests
|
|
|
|
---
|
|
src/twisted/internet/test/test_inlinecb.py | 71 ++++++++++++++++++++++
|
|
1 file changed, 71 insertions(+)
|
|
|
|
diff --git a/src/twisted/internet/test/test_inlinecb.py b/src/twisted/internet/test/test_inlinecb.py
|
|
index a8fcc77351d..1ab00df4230 100644
|
|
--- a/src/twisted/internet/test/test_inlinecb.py
|
|
+++ b/src/twisted/internet/test/test_inlinecb.py
|
|
@@ -9,6 +9,8 @@
|
|
well.
|
|
"""
|
|
|
|
+import sys
|
|
+from unittest import skipIf
|
|
|
|
from twisted.internet.defer import (
|
|
CancelledError,
|
|
@@ -126,6 +128,7 @@ def inline():
|
|
|
|
|
|
class ForwardTraceBackTests(SynchronousTestCase):
|
|
+ @skipIf(sys.version_info > (3, 12), 'applies to Python 3.12 and older')
|
|
def test_forwardTracebacks(self):
|
|
"""
|
|
Chained inlineCallbacks are forwarding the traceback information
|
|
@@ -150,6 +153,32 @@ def calling():
|
|
self.assertIn("in calling", tb)
|
|
self.assertIn("Error Marker", tb)
|
|
|
|
+ @skipIf(sys.version_info < (3, 13), 'new in Python 3.13')
|
|
+ def test_forwardTracebacks313(self):
|
|
+ """
|
|
+ Chained inlineCallbacks are forwarding the traceback information
|
|
+ from generator to generator.
|
|
+
|
|
+ A first simple test with a couple of inline callbacks.
|
|
+ """
|
|
+
|
|
+ @inlineCallbacks
|
|
+ def erroring():
|
|
+ yield "forcing generator"
|
|
+ raise Exception("Error Marker")
|
|
+
|
|
+ @inlineCallbacks
|
|
+ def calling():
|
|
+ yield erroring()
|
|
+
|
|
+ d = calling()
|
|
+ f = self.failureResultOf(d)
|
|
+ tb = f.getTraceback()
|
|
+ self.assertIn("yield erroring", tb)
|
|
+ self.assertIn("in calling", tb)
|
|
+ self.assertIn("Error Marker", tb)
|
|
+
|
|
+ @skipIf(sys.version_info > (3, 12), 'applies to Python 3.12 and older')
|
|
def test_forwardLotsOfTracebacks(self):
|
|
"""
|
|
Several Chained inlineCallbacks gives information about all generators.
|
|
@@ -197,6 +226,48 @@ def calling():
|
|
self.assertIn("Error Marker", tb)
|
|
self.assertIn("in erroring", f.getTraceback())
|
|
|
|
+ @skipIf(sys.version_info < (3, 13), 'new in Python 3.13')
|
|
+ def test_forwardLotsOfTracebacks313(self):
|
|
+ """
|
|
+ Several Chained inlineCallbacks gives information about all generators.
|
|
+
|
|
+ A wider test with a 4 chained inline callbacks.
|
|
+
|
|
+ Note that the previous test is testing the simple case, and this one is
|
|
+ testing the deep recursion case.
|
|
+
|
|
+ That case needs specific code in failure.py to accomodate to stack
|
|
+ breakage introduced by throwExceptionIntoGenerator.
|
|
+
|
|
+ Hence we keep the two tests in order to sort out which code we
|
|
+ might have regression in.
|
|
+ """
|
|
+
|
|
+ @inlineCallbacks
|
|
+ def erroring():
|
|
+ yield "forcing generator"
|
|
+ raise Exception("Error Marker")
|
|
+
|
|
+ @inlineCallbacks
|
|
+ def calling3():
|
|
+ yield erroring()
|
|
+
|
|
+ @inlineCallbacks
|
|
+ def calling2():
|
|
+ yield calling3()
|
|
+
|
|
+ @inlineCallbacks
|
|
+ def calling():
|
|
+ yield calling2()
|
|
+
|
|
+ d = calling()
|
|
+ f = self.failureResultOf(d)
|
|
+ tb = f.getTraceback()
|
|
+ self.assertIn("in calling", tb)
|
|
+ self.assertIn("yield calling2", tb)
|
|
+ self.assertIn("throwExceptionIntoGenerator", tb)
|
|
+ self.assertIn("Error Marker", tb)
|
|
+
|
|
|
|
class UntranslatedError(Exception):
|
|
"""
|
|
|
|
From 1545ecae0b73cbdf80a83816cb2cf7beb701c9ee Mon Sep 17 00:00:00 2001
|
|
From: eevelweezel <eevel.weezel@gmail.com>
|
|
Date: Wed, 24 Jan 2024 22:06:04 -0600
|
|
Subject: [PATCH 2/4] add newsfragment
|
|
|
|
---
|
|
src/twisted/newsfragments/12061.misc | 1 +
|
|
1 file changed, 1 insertion(+)
|
|
create mode 100644 src/twisted/newsfragments/12061.misc
|
|
|
|
diff --git a/src/twisted/newsfragments/12061.misc b/src/twisted/newsfragments/12061.misc
|
|
new file mode 100644
|
|
index 00000000000..4880acc97d9
|
|
--- /dev/null
|
|
+++ b/src/twisted/newsfragments/12061.misc
|
|
@@ -0,0 +1 @@
|
|
+Make inline callback tests compatible with 3.13.
|
|
|
|
From 0e5b1896b99cddcab47ed0f7963837a3242f8a3e Mon Sep 17 00:00:00 2001
|
|
From: eevelweezel <eevel.weezel@gmail.com>
|
|
Date: Wed, 24 Jan 2024 22:33:26 -0600
|
|
Subject: [PATCH 3/4] fix tests in light of codecoverage
|
|
|
|
---
|
|
src/twisted/internet/test/test_inlinecb.py | 82 +---------------------
|
|
1 file changed, 3 insertions(+), 79 deletions(-)
|
|
|
|
diff --git a/src/twisted/internet/test/test_inlinecb.py b/src/twisted/internet/test/test_inlinecb.py
|
|
index 1ab00df4230..2efdd68d2d2 100644
|
|
--- a/src/twisted/internet/test/test_inlinecb.py
|
|
+++ b/src/twisted/internet/test/test_inlinecb.py
|
|
@@ -9,8 +9,6 @@
|
|
well.
|
|
"""
|
|
|
|
-import sys
|
|
-from unittest import skipIf
|
|
|
|
from twisted.internet.defer import (
|
|
CancelledError,
|
|
@@ -128,7 +126,6 @@ def inline():
|
|
|
|
|
|
class ForwardTraceBackTests(SynchronousTestCase):
|
|
- @skipIf(sys.version_info > (3, 12), 'applies to Python 3.12 and older')
|
|
def test_forwardTracebacks(self):
|
|
"""
|
|
Chained inlineCallbacks are forwarding the traceback information
|
|
@@ -149,89 +146,17 @@ def calling():
|
|
d = calling()
|
|
f = self.failureResultOf(d)
|
|
tb = f.getTraceback()
|
|
- self.assertIn("in erroring", tb)
|
|
+ self.assertIn("erroring", tb)
|
|
self.assertIn("in calling", tb)
|
|
self.assertIn("Error Marker", tb)
|
|
|
|
- @skipIf(sys.version_info < (3, 13), 'new in Python 3.13')
|
|
- def test_forwardTracebacks313(self):
|
|
- """
|
|
- Chained inlineCallbacks are forwarding the traceback information
|
|
- from generator to generator.
|
|
-
|
|
- A first simple test with a couple of inline callbacks.
|
|
- """
|
|
-
|
|
- @inlineCallbacks
|
|
- def erroring():
|
|
- yield "forcing generator"
|
|
- raise Exception("Error Marker")
|
|
-
|
|
- @inlineCallbacks
|
|
- def calling():
|
|
- yield erroring()
|
|
-
|
|
- d = calling()
|
|
- f = self.failureResultOf(d)
|
|
- tb = f.getTraceback()
|
|
- self.assertIn("yield erroring", tb)
|
|
- self.assertIn("in calling", tb)
|
|
- self.assertIn("Error Marker", tb)
|
|
-
|
|
- @skipIf(sys.version_info > (3, 12), 'applies to Python 3.12 and older')
|
|
def test_forwardLotsOfTracebacks(self):
|
|
"""
|
|
Several Chained inlineCallbacks gives information about all generators.
|
|
|
|
A wider test with a 4 chained inline callbacks.
|
|
|
|
- Application stack-trace should be reported, and implementation details
|
|
- like "throwExceptionIntoGenerator" symbols are omitted from the stack.
|
|
-
|
|
- Note that the previous test is testing the simple case, and this one is
|
|
- testing the deep recursion case.
|
|
-
|
|
- That case needs specific code in failure.py to accomodate to stack
|
|
- breakage introduced by throwExceptionIntoGenerator.
|
|
-
|
|
- Hence we keep the two tests in order to sort out which code we
|
|
- might have regression in.
|
|
- """
|
|
-
|
|
- @inlineCallbacks
|
|
- def erroring():
|
|
- yield "forcing generator"
|
|
- raise Exception("Error Marker")
|
|
-
|
|
- @inlineCallbacks
|
|
- def calling3():
|
|
- yield erroring()
|
|
-
|
|
- @inlineCallbacks
|
|
- def calling2():
|
|
- yield calling3()
|
|
-
|
|
- @inlineCallbacks
|
|
- def calling():
|
|
- yield calling2()
|
|
-
|
|
- d = calling()
|
|
- f = self.failureResultOf(d)
|
|
- tb = f.getTraceback()
|
|
- self.assertIn("in erroring", tb)
|
|
- self.assertIn("in calling", tb)
|
|
- self.assertIn("in calling2", tb)
|
|
- self.assertIn("in calling3", tb)
|
|
- self.assertNotIn("throwExceptionIntoGenerator", tb)
|
|
- self.assertIn("Error Marker", tb)
|
|
- self.assertIn("in erroring", f.getTraceback())
|
|
-
|
|
- @skipIf(sys.version_info < (3, 13), 'new in Python 3.13')
|
|
- def test_forwardLotsOfTracebacks313(self):
|
|
- """
|
|
- Several Chained inlineCallbacks gives information about all generators.
|
|
-
|
|
- A wider test with a 4 chained inline callbacks.
|
|
+ Application stack-trace should be reported.
|
|
|
|
Note that the previous test is testing the simple case, and this one is
|
|
testing the deep recursion case.
|
|
@@ -264,8 +189,7 @@ def calling():
|
|
f = self.failureResultOf(d)
|
|
tb = f.getTraceback()
|
|
self.assertIn("in calling", tb)
|
|
- self.assertIn("yield calling2", tb)
|
|
- self.assertIn("throwExceptionIntoGenerator", tb)
|
|
+ self.assertIn("calling2", tb)
|
|
self.assertIn("Error Marker", tb)
|
|
|
|
|
|
|
|
From 6376bbc5193ec055ec4abcc3b13da8b3934f652a Mon Sep 17 00:00:00 2001
|
|
From: eevelweezel <eevel.weezel@gmail.com>
|
|
Date: Wed, 24 Jan 2024 22:47:16 -0600
|
|
Subject: [PATCH 4/4] typo
|
|
|
|
---
|
|
src/twisted/internet/test/test_inlinecb.py | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/src/twisted/internet/test/test_inlinecb.py b/src/twisted/internet/test/test_inlinecb.py
|
|
index 2efdd68d2d2..3983767a464 100644
|
|
--- a/src/twisted/internet/test/test_inlinecb.py
|
|
+++ b/src/twisted/internet/test/test_inlinecb.py
|
|
@@ -154,7 +154,7 @@ def test_forwardLotsOfTracebacks(self):
|
|
"""
|
|
Several Chained inlineCallbacks gives information about all generators.
|
|
|
|
- A wider test with a 4 chained inline callbacks.
|
|
+ A wider test with 4 chained inline callbacks.
|
|
|
|
Application stack-trace should be reported.
|
|
|