From 137448dacddba69eeac8399c5abb3b11cdb98d02 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sun, 18 Aug 2024 18:58:11 +0100 Subject: [PATCH] Fix tests with Twisted 24.7.0 `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 | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tornado/test/twisted_test.py b/tornado/test/twisted_test.py index 7f983a73e7..36a541a7a8 100644 --- a/tornado/test/twisted_test.py +++ b/tornado/test/twisted_test.py @@ -18,10 +18,7 @@ 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 @@ def fn(): # 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)