(self)
| 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): |
nothing calls this directly
no test coverage detected