Skip to content

Commit

Permalink
filter set_event_loop deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
finnagin authored Feb 18, 2025
1 parent a3e2e83 commit 4432947
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tornado/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,15 @@ def setUp(self) -> None:
if type(self).get_new_ioloop is not AsyncTestCase.get_new_ioloop:
warnings.warn("get_new_ioloop is deprecated", DeprecationWarning)
self.io_loop = self.get_new_ioloop()
if ((3, 14, 0) <= py_ver):
# Early releases in the Python 3.10 and 3.1 series had deprecation
# warnings that were later reverted; we must suppress them here.
setup_with_context_manager(self, warnings.catch_warnings())
warnings.filterwarnings(
"ignore",
message="'asyncio.set_event_loop' is deprecated",
category=DeprecationWarning,
)
asyncio.set_event_loop(self.io_loop.asyncio_loop) # type: ignore[attr-defined]

def tearDown(self) -> None:
Expand Down

0 comments on commit 4432947

Please sign in to comment.