summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2019-11-06 03:21:29 (GMT)
committerGitHub <noreply@github.com>2019-11-06 03:21:29 (GMT)
commit6c4c45efaeb40f4f837570f57d90a0b3429c6ae9 (patch)
tree4abd982b8454d295f7f0c16c2ab0ab94014ce584 /Lib
parent56698d57691af2272f695f8c17c835ed99545cde (diff)
downloadcpython-6c4c45efaeb40f4f837570f57d90a0b3429c6ae9.zip
cpython-6c4c45efaeb40f4f837570f57d90a0b3429c6ae9.tar.gz
cpython-6c4c45efaeb40f4f837570f57d90a0b3429c6ae9.tar.bz2
bpo-38692: Add os.pidfd_open. (GH-17063)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_posix.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 17e4ded2..98a39c3 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -1470,6 +1470,15 @@ class PosixTester(unittest.TestCase):
open(fn, 'wb').close()
self.assertRaises(ValueError, os.stat, fn_with_NUL)
+ @unittest.skipUnless(hasattr(os, "pidfd_open"), "pidfd_open unavailable")
+ def test_pidfd_open(self):
+ with self.assertRaises(OSError) as cm:
+ os.pidfd_open(-1)
+ if cm.exception.errno == errno.ENOSYS:
+ self.skipTest("system does not support pidfd_open")
+ self.assertEqual(cm.exception.errno, errno.EINVAL)
+ os.close(os.pidfd_open(os.getpid(), 0))
+
class PosixGroupsTester(unittest.TestCase):
def setUp(self):