]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Fix tests with Twisted 24.7.0 3417/head
authorColin Watson <cjwatson@debian.org>
Sun, 18 Aug 2024 17:58:11 +0000 (18:58 +0100)
committerColin Watson <cjwatson@debian.org>
Sun, 18 Aug 2024 17:58:11 +0000 (18:58 +0100)
`twisted.internet.defer.returnValue` was needed on Python 2, but on
Python 3 a simple `return` statement works fine.  Twisted 24.7.0
deprecated the former, causing
`tornado.test.twisted_test.ConvertDeferredTest.test_success` to fail.

tornado/test/twisted_test.py

index 7f983a73e7043a31b4df3adf2be126e5bcbbdc71..36a541a7a84392ac8380f24842b5e7bee2fcb974 100644 (file)
@@ -18,10 +18,7 @@ import unittest
 from tornado.testing import AsyncTestCase, gen_test
 
 try:
-    from twisted.internet.defer import (  # type: ignore
-        inlineCallbacks,
-        returnValue,
-    )
+    from twisted.internet.defer import inlineCallbacks  # type: ignore
 
     have_twisted = True
 except ImportError:
@@ -43,7 +40,7 @@ class ConvertDeferredTest(AsyncTestCase):
                 # inlineCallbacks doesn't work with regular functions;
                 # must have a yield even if it's unreachable.
                 yield
-            returnValue(42)
+            return 42
 
         res = yield fn()
         self.assertEqual(res, 42)