mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-38692: Skip test_posix.test_pidfd_open() on EPERM (GH-17290)
Skip the test_posix.test_pidfd_open() test if os.pidfd_open() fails with a PermissionError. This situation can happen in a Linux sandbox using a syscall whitelist which doesn't allow the pidfd_open() syscall yet (like systemd-nspawn).
This commit is contained in:
parent
0127bb1c5c
commit
3ab479a2d1
2 changed files with 5 additions and 0 deletions
|
@ -1476,6 +1476,8 @@ class PosixTester(unittest.TestCase):
|
|||
os.pidfd_open(-1)
|
||||
if cm.exception.errno == errno.ENOSYS:
|
||||
self.skipTest("system does not support pidfd_open")
|
||||
if isinstance(cm.exception, PermissionError):
|
||||
self.skipTest(f"pidfd_open syscall blocked: {cm.exception!r}")
|
||||
self.assertEqual(cm.exception.errno, errno.EINVAL)
|
||||
os.close(os.pidfd_open(os.getpid(), 0))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue