Skip to content

Commit

Permalink
Fix tests with Twisted 24.7.0
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
cjwatson committed Aug 18, 2024
1 parent 1f8b2d7 commit 137448d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions tornado/test/twisted_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down

0 comments on commit 137448d

Please sign in to comment.