(self)
| 1735 | |
| 1736 | @unittest.skipUnless(os.utime in os.supports_dir_fd, "test needs dir_fd support in os.utime()") |
| 1737 | def test_utime_dir_fd(self): |
| 1738 | with self.prepare_file() as (dir_fd, name, fullname): |
| 1739 | now = time.time() |
| 1740 | posix.utime(name, None, dir_fd=dir_fd) |
| 1741 | posix.utime(name, dir_fd=dir_fd) |
| 1742 | self.assertRaises(TypeError, posix.utime, name, |
| 1743 | now, dir_fd=dir_fd) |
| 1744 | self.assertRaises(TypeError, posix.utime, name, |
| 1745 | (None, None), dir_fd=dir_fd) |
| 1746 | self.assertRaises(TypeError, posix.utime, name, |
| 1747 | (now, None), dir_fd=dir_fd) |
| 1748 | self.assertRaises(TypeError, posix.utime, name, |
| 1749 | (None, now), dir_fd=dir_fd) |
| 1750 | self.assertRaises(TypeError, posix.utime, name, |
| 1751 | (now, "x"), dir_fd=dir_fd) |
| 1752 | posix.utime(name, (int(now), int(now)), dir_fd=dir_fd) |
| 1753 | posix.utime(name, (now, now), dir_fd=dir_fd) |
| 1754 | posix.utime(name, |
| 1755 | (int(now), int((now - int(now)) * 1e9)), dir_fd=dir_fd) |
| 1756 | posix.utime(name, dir_fd=dir_fd, |
| 1757 | times=(int(now), int((now - int(now)) * 1e9))) |
| 1758 | |
| 1759 | # try dir_fd and follow_symlinks together |
| 1760 | if os.utime in os.supports_follow_symlinks: |
| 1761 | try: |
| 1762 | posix.utime(name, follow_symlinks=False, dir_fd=dir_fd) |
| 1763 | except ValueError: |
| 1764 | # whoops! using both together not supported on this platform. |
| 1765 | pass |
| 1766 | |
| 1767 | @unittest.skipIf( |
| 1768 | support.is_wasi, |
nothing calls this directly
no test coverage detected