def test_fdlistdir(tmpdir): tmpdir.join('file').write('text') dirfd = os.open(str(tmpdir), os.O_RDONLY) result = rposix.fdlistdir(dirfd) # Note: fdlistdir() always closes dirfd assert result == ['file']
def test_fdlistdir_rewinddir(tmpdir): tmpdir.join('file').write('text') dirfd = os.open(str(tmpdir), os.O_RDONLY) result1 = rposix.fdlistdir(os.dup(dirfd)) result2 = rposix.fdlistdir(dirfd) assert result1 == result2 == ['file']