MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_mknod_dir_fd

Method test_mknod_dir_fd

Lib/test/test_posix.py:1724–1737  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1722 and hasattr(stat, 'S_IFIFO'),
1723 "test requires both stat.S_IFIFO and dir_fd support for os.mknod()")
1724 def test_mknod_dir_fd(self):
1725 # Test using mknodat() to create a FIFO (the only use specified
1726 # by POSIX).
1727 with self.prepare() as (dir_fd, name, fullname):
1728 mode = stat.S_IFIFO | stat.S_IRUSR | stat.S_IWUSR
1729 try:
1730 posix.mknod(name, mode, 0, dir_fd=dir_fd)
1731 except OSError as e:
1732 # Some old systems don't allow unprivileged users to use
1733 # mknod(), or only support creating device nodes.
1734 self.assertIn(e.errno, (errno.EPERM, errno.EINVAL, errno.EACCES))
1735 else:
1736 self.addCleanup(posix.unlink, fullname)
1737 self.assertTrue(stat.S_ISFIFO(posix.stat(fullname).st_mode))
1738
1739 @unittest.skipUnless(os.open in os.supports_dir_fd, "test needs dir_fd support in os.open()")
1740 def test_open_dir_fd(self):

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected