mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
GH-94597: deprecate SafeChildWatcher
, FastChildWatcher
and MultiLoopChildWatcher
child watchers (#98089)
This commit is contained in:
parent
75751f4aa5
commit
d8765284f3
7 changed files with 81 additions and 38 deletions
|
@ -12,6 +12,7 @@ import sys
|
|||
import threading
|
||||
import unittest
|
||||
from unittest import mock
|
||||
import warnings
|
||||
from test.support import os_helper
|
||||
from test.support import socket_helper
|
||||
|
||||
|
@ -1686,12 +1687,16 @@ class ChildWatcherTestsMixin:
|
|||
|
||||
class SafeChildWatcherTests (ChildWatcherTestsMixin, test_utils.TestCase):
|
||||
def create_watcher(self):
|
||||
return asyncio.SafeChildWatcher()
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore", DeprecationWarning)
|
||||
return asyncio.SafeChildWatcher()
|
||||
|
||||
|
||||
class FastChildWatcherTests (ChildWatcherTestsMixin, test_utils.TestCase):
|
||||
def create_watcher(self):
|
||||
return asyncio.FastChildWatcher()
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore", DeprecationWarning)
|
||||
return asyncio.FastChildWatcher()
|
||||
|
||||
|
||||
class PolicyTests(unittest.TestCase):
|
||||
|
@ -1724,7 +1729,9 @@ class PolicyTests(unittest.TestCase):
|
|||
|
||||
def test_get_child_watcher_after_set(self):
|
||||
policy = self.create_policy()
|
||||
watcher = asyncio.FastChildWatcher()
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore", DeprecationWarning)
|
||||
watcher = asyncio.FastChildWatcher()
|
||||
|
||||
policy.set_child_watcher(watcher)
|
||||
self.assertIs(policy._watcher, watcher)
|
||||
|
@ -1745,7 +1752,9 @@ class PolicyTests(unittest.TestCase):
|
|||
policy.get_event_loop().close()
|
||||
|
||||
policy = self.create_policy()
|
||||
policy.set_child_watcher(asyncio.SafeChildWatcher())
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore", DeprecationWarning)
|
||||
policy.set_child_watcher(asyncio.SafeChildWatcher())
|
||||
|
||||
th = threading.Thread(target=f)
|
||||
th.start()
|
||||
|
@ -1757,7 +1766,9 @@ class PolicyTests(unittest.TestCase):
|
|||
|
||||
# Explicitly setup SafeChildWatcher,
|
||||
# default ThreadedChildWatcher has no _loop property
|
||||
watcher = asyncio.SafeChildWatcher()
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore", DeprecationWarning)
|
||||
watcher = asyncio.SafeChildWatcher()
|
||||
policy.set_child_watcher(watcher)
|
||||
watcher.attach_loop(loop)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue