Skip to content

Commit

Permalink
filter deprecation in tcpserver_test
Browse files Browse the repository at this point in the history
  • Loading branch information
finnagin authored Feb 19, 2025
1 parent 86b000c commit bef7fbb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tornado/test/tcpserver_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from tornado.log import app_log
from tornado.tcpserver import TCPServer
from tornado.test.util import skipIfNonUnix
from tornado.testing import AsyncTestCase, ExpectLog, bind_unused_port, gen_test
from tornado.testing import AsyncTestCase, ExpectLog, bind_unused_port, gen_test, setup_with_context_manager

from typing import Tuple

Expand Down Expand Up @@ -125,6 +125,15 @@ class TestMultiprocess(unittest.TestCase):
# stdout stream) and then exits.
def run_subproc(self, code: str) -> Tuple[str, str]:
try:
py_ver = sys.version_info
if (3, 14, 0) <= py_ver:
# 3458 - This will work until 3.16 when the function is fully removed
setup_with_context_manager(self, warnings.catch_warnings())
warnings.filterwarnings(
"ignore",
message="'asyncio.DefaultEventLoopPolicy' is deprecated",
category=DeprecationWarning,
)
result = subprocess.run(
[sys.executable, "-Werror::DeprecationWarning"],
capture_output=True,
Expand Down

0 comments on commit bef7fbb

Please sign in to comment.