diff options
author | Benjamin Peterson <benjamin@python.org> | 2019-11-14 03:08:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-14 03:08:50 (GMT) |
commit | 3ccdd9b180f9a3f29c8ddc8ad1b331fe8df26519 (patch) | |
tree | 9353e254fbb988e8325a99269dee89af50cbd74f /Lib/test | |
parent | dad6be5ffe48beb74fad78cf758b886afddc7aed (diff) | |
download | cpython-3ccdd9b180f9a3f29c8ddc8ad1b331fe8df26519.zip cpython-3ccdd9b180f9a3f29c8ddc8ad1b331fe8df26519.tar.gz cpython-3ccdd9b180f9a3f29c8ddc8ad1b331fe8df26519.tar.bz2 |
closes bpo-38692: Add a pidfd child process watcher to asyncio. (GH-17069)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_asyncio/test_subprocess.py | 18 |
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): |