mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
GH-120804: Remove get_child_watcher and set_child_watcher from asyncio (#120818)
This commit is contained in:
parent
4717aaa1a7
commit
96ead91f0f
6 changed files with 18 additions and 227 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue