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

@ -1138,35 +1138,6 @@ def test_not_implemented(self):
NotImplementedError, watcher.__exit__, f, f, f)
class PolicyTests(unittest.TestCase):
def create_policy(self):
return asyncio.DefaultEventLoopPolicy()
@mock.patch('asyncio.unix_events.can_use_pidfd')
def test_get_default_child_watcher(self, m_can_use_pidfd):
m_can_use_pidfd.return_value = False
policy = self.create_policy()
self.assertIsNone(policy._watcher)
with self.assertWarns(DeprecationWarning):
watcher = policy.get_child_watcher()
self.assertIsInstance(watcher, asyncio.ThreadedChildWatcher)
self.assertIs(policy._watcher, watcher)
with self.assertWarns(DeprecationWarning):
self.assertIs(watcher, policy.get_child_watcher())
m_can_use_pidfd.return_value = True
policy = self.create_policy()
self.assertIsNone(policy._watcher)
with self.assertWarns(DeprecationWarning):
watcher = policy.get_child_watcher()
self.assertIsInstance(watcher, asyncio.PidfdChildWatcher)
self.assertIs(policy._watcher, watcher)
with self.assertWarns(DeprecationWarning):
self.assertIs(watcher, policy.get_child_watcher())
class TestFunctional(unittest.TestCase):
def setUp(self):