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

Method test_open_dir_fd

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

Source from the content-addressed store, hash-verified

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):
1741 with self.prepare() as (dir_fd, name, fullname):
1742 with open(fullname, 'wb') as outfile:
1743 outfile.write(b"testline\n")
1744 self.addCleanup(posix.unlink, fullname)
1745 fd = posix.open(name, posix.O_RDONLY, dir_fd=dir_fd)
1746 try:
1747 res = posix.read(fd, 9)
1748 self.assertEqual(b"testline\n", res)
1749 finally:
1750 posix.close(fd)
1751
1752 @unittest.skipUnless(hasattr(os, 'readlink') and (os.readlink in os.supports_dir_fd),
1753 "test needs dir_fd support in os.readlink()")

Callers

nothing calls this directly

Calls 8

prepareMethod · 0.95
addCleanupMethod · 0.80
openFunction · 0.50
writeMethod · 0.45
openMethod · 0.45
readMethod · 0.45
assertEqualMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected