summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_subprocess.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_asyncio/test_subprocess.py')
-rw-r--r--Lib/test/test_asyncio/test_subprocess.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py
index 17552d0..a6c3acc 100644
--- a/Lib/test/test_asyncio/test_subprocess.py
+++ b/Lib/test/test_asyncio/test_subprocess.py
@@ -1,3 +1,4 @@
+import os
import signal
import sys
import unittest
@@ -691,6 +692,23 @@ if sys.platform != 'win32':
Watcher = unix_events.FastChildWatcher
+ def has_pidfd_support():
+ if not hasattr(os, 'pidfd_open'):
+ return False
+ try:
+ os.close(os.pidfd_open(os.getpid()))
+ except OSError:
+ return False
+ return True
+
+ @unittest.skipUnless(
+ has_pidfd_support(),
+ "operating system does not support pidfds",
+ )
+ class SubprocessPidfdWatcherTests(SubprocessWatcherMixin,
+ test_utils.TestCase):
+ Watcher = unix_events.PidfdChildWatcher
+
else:
# Windows
class SubprocessProactorTests(SubprocessMixin, test_utils.TestCase):