Skip to content

Commit

Permalink
testing: Suppress deprecation warnings in AsyncTestCase
Browse files Browse the repository at this point in the history
This is a temporary measure to get CI passing while the fate of these
deprecation warnings is decided in
python/cpython#130322
  • Loading branch information
bdarnell committed Feb 20, 2025
1 parent c8fc890 commit 5ae2fbb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tornado/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,19 @@ def setUp(self) -> None:
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)
Expand Down

0 comments on commit 5ae2fbb

Please sign in to comment.