From: Ben Darnell Date: Thu, 20 Feb 2025 19:22:14 +0000 (-0500) Subject: testing: Suppress deprecation warnings in AsyncTestCase X-Git-Tag: v6.5.0b1~26^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ae2fbbe2d1908e96cc4d4934625392cf46489ec;p=thirdparty%2Ftornado.git testing: Suppress deprecation warnings in AsyncTestCase This is a temporary measure to get CI passing while the fate of these deprecation warnings is decided in https://github.com/python/cpython/issues/130322 --- diff --git a/tornado/testing.py b/tornado/testing.py index a397e3fa..9f54a1e2 100644 --- a/tornado/testing.py +++ b/tornado/testing.py @@ -155,6 +155,19 @@ class AsyncTestCase(unittest.TestCase): category=DeprecationWarning, module=r"tornado\..*", ) + if (3, 14) <= py_ver: + # TODO: This is a temporary hack pending resolution of + # https://github.com/python/cpython/issues/130322 + # If set_event_loop is undeprecated, we can remove it; if not + # we need substantial changes to this class to use asyncio.Runner + # like IsolatedAsyncioTestCase does. + setup_with_context_manager(self, warnings.catch_warnings()) + warnings.filterwarnings( + "ignore", + message="'asyncio.set_event_loop' is deprecated", + category=DeprecationWarning, + module="tornado.testing", + ) super().setUp() if type(self).get_new_ioloop is not AsyncTestCase.get_new_ioloop: warnings.warn("get_new_ioloop is deprecated", DeprecationWarning)