summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_unix_events.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_asyncio/test_unix_events.py')
-rw-r--r--Lib/test/test_asyncio/test_unix_events.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/test/test_asyncio/test_unix_events.py b/Lib/test/test_asyncio/test_unix_events.py
index 5bad21e..03fb5e6 100644
--- a/Lib/test/test_asyncio/test_unix_events.py
+++ b/Lib/test/test_asyncio/test_unix_events.py
@@ -1702,7 +1702,8 @@ class PolicyTests(unittest.TestCase):
def test_get_default_child_watcher(self):
policy = self.create_policy()
self.assertIsNone(policy._watcher)
-
+ unix_events.can_use_pidfd = mock.Mock()
+ unix_events.can_use_pidfd.return_value = False
watcher = policy.get_child_watcher()
self.assertIsInstance(watcher, asyncio.ThreadedChildWatcher)
@@ -1710,6 +1711,17 @@ class PolicyTests(unittest.TestCase):
self.assertIs(watcher, policy.get_child_watcher())
+ policy = self.create_policy()
+ self.assertIsNone(policy._watcher)
+ unix_events.can_use_pidfd = mock.Mock()
+ unix_events.can_use_pidfd.return_value = True
+ watcher = policy.get_child_watcher()
+ self.assertIsInstance(watcher, asyncio.PidfdChildWatcher)
+
+ self.assertIs(policy._watcher, watcher)
+
+ self.assertIs(watcher, policy.get_child_watcher())
+
def test_get_child_watcher_after_set(self):
policy = self.create_policy()
watcher = asyncio.FastChildWatcher()