diff options
Diffstat (limited to 'Lib/test/test_posix.py')
-rw-r--r-- | Lib/test/test_posix.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 2fb8200..23c2100 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -285,6 +285,18 @@ class PosixTester(unittest.TestCase): if hasattr(posix, 'listdir'): self.assertTrue(support.TESTFN in posix.listdir()) + @unittest.skipUnless(hasattr(posix, 'fdlistdir'), "test needs posix.fdlistdir()") + def test_fdlistdir(self): + f = posix.open(posix.getcwd(), posix.O_RDONLY) + self.assertEqual( + sorted(posix.listdir('.')), + sorted(posix.fdlistdir(f)) + ) + # Check the fd was closed by fdlistdir + with self.assertRaises(OSError) as ctx: + posix.close(f) + self.assertEqual(ctx.exception.errno, errno.EBADF) + def test_access(self): if hasattr(posix, 'access'): self.assertTrue(posix.access(support.TESTFN, os.R_OK)) |