GH-120804: Remove get_child_watcher and set_child_watcher from asyncio (#120818)

This commit is contained in:
Kumar Aditya 2024-06-23 09:53:23 +05:30 committed by GitHub
parent 4717aaa1a7
commit 96ead91f0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 18 additions and 227 deletions

View file

@ -2212,16 +2212,14 @@ else:
class UnixEventLoopTestsMixin(EventLoopTestsMixin):
def setUp(self):
super().setUp()
with warnings.catch_warnings():
warnings.simplefilter('ignore', DeprecationWarning)
watcher = asyncio.ThreadedChildWatcher()
watcher.attach_loop(self.loop)
asyncio.set_child_watcher(watcher)
watcher = asyncio.ThreadedChildWatcher()
watcher.attach_loop(self.loop)
policy = asyncio.get_event_loop_policy()
policy._watcher = watcher
def tearDown(self):
with warnings.catch_warnings():
warnings.simplefilter('ignore', DeprecationWarning)
asyncio.set_child_watcher(None)
policy = asyncio.get_event_loop_policy()
policy._watcher = None
super().tearDown()
@ -2716,9 +2714,6 @@ class PolicyTests(unittest.TestCase):
self.assertRaises(NotImplementedError, policy.get_event_loop)
self.assertRaises(NotImplementedError, policy.set_event_loop, object())
self.assertRaises(NotImplementedError, policy.new_event_loop)
self.assertRaises(NotImplementedError, policy.get_child_watcher)
self.assertRaises(NotImplementedError, policy.set_child_watcher,
object())
def test_get_event_loop(self):
policy = asyncio.DefaultEventLoopPolicy()
@ -2836,9 +2831,8 @@ class GetEventLoopTestsMixin:
def tearDown(self):
try:
if sys.platform != 'win32':
with warnings.catch_warnings():
warnings.simplefilter('ignore', DeprecationWarning)
asyncio.set_child_watcher(None)
policy = asyncio.get_event_loop_policy()
policy._watcher = None
super().tearDown()
finally: