From: Colin Watson Date: Sun, 18 Aug 2024 17:58:11 +0000 (+0100) Subject: Fix tests with Twisted 24.7.0 X-Git-Tag: v6.5.0b1~38^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3417%2Fhead;p=thirdparty%2Ftornado.git 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. --- diff --git a/tornado/test/twisted_test.py b/tornado/test/twisted_test.py index 7f983a73..36a541a7 100644 --- a/tornado/test/twisted_test.py +++ b/tornado/test/twisted_test.py @@ -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)