MCPcopy Create free account
hub / github.com/python/cpython / test_mknod_dir_fd

Method test_mknod_dir_fd

Lib/test/test_os/test_posix.py:1798–1811  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1796 and hasattr(stat, 'S_IFIFO'),
1797 "test requires both stat.S_IFIFO and dir_fd support for os.mknod()")
1798 def test_mknod_dir_fd(self):
1799 # Test using mknodat() to create a FIFO (the only use specified
1800 # by POSIX).
1801 with self.prepare() as (dir_fd, name, fullname):
1802 mode = stat.S_IFIFO | stat.S_IRUSR | stat.S_IWUSR
1803 try:
1804 posix.mknod(name, mode, 0, dir_fd=dir_fd)
1805 except OSError as e:
1806 # Some old systems don't allow unprivileged users to use
1807 # mknod(), or only support creating device nodes.
1808 self.assertIn(e.errno, (errno.EPERM, errno.EINVAL, errno.EACCES))
1809 else:
1810 self.addCleanup(posix.unlink, fullname)
1811 self.assertTrue(stat.S_ISFIFO(posix.stat(fullname).st_mode))
1812
1813 @unittest.skipUnless(os.open in os.supports_dir_fd, "test needs dir_fd support in os.open()")
1814 def test_open_dir_fd(self):

Callers

nothing calls this directly

Calls 5

prepareMethod · 0.95
assertInMethod · 0.80
addCleanupMethod · 0.80
assertTrueMethod · 0.80
statMethod · 0.45

Tested by

no test coverage detected