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

Method test_mknod

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

Source from the content-addressed store, hash-verified

715 @unittest.skipUnless(hasattr(posix, 'mknod') and hasattr(stat, 'S_IFIFO'),
716 "don't have mknod()/S_IFIFO")
717 def test_mknod(self):
718 # Test using mknod() to create a FIFO (the only use specified
719 # by POSIX).
720 os_helper.unlink(os_helper.TESTFN)
721 mode = stat.S_IFIFO | stat.S_IRUSR | stat.S_IWUSR
722 try:
723 posix.mknod(os_helper.TESTFN, mode, 0)
724 except OSError as e:
725 # Some old systems don't allow unprivileged users to use
726 # mknod(), or only support creating device nodes.
727 self.assertIn(e.errno, (errno.EPERM, errno.EINVAL, errno.EACCES))
728 else:
729 self.assertTrue(stat.S_ISFIFO(posix.stat(os_helper.TESTFN).st_mode))
730
731 # Keyword arguments are also supported
732 os_helper.unlink(os_helper.TESTFN)
733 try:
734 posix.mknod(path=os_helper.TESTFN, mode=mode, device=0,
735 dir_fd=None)
736 except OSError as e:
737 self.assertIn(e.errno, (errno.EPERM, errno.EINVAL, errno.EACCES))
738
739 @unittest.skipUnless(hasattr(posix, 'makedev'), 'test needs posix.makedev()')
740 def test_makedev(self):

Callers

nothing calls this directly

Calls 5

mknodMethod · 0.80
assertInMethod · 0.80
assertTrueMethod · 0.80
unlinkMethod · 0.45
statMethod · 0.45

Tested by

no test coverage detected