diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-02-25 23:41:16 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-02-25 23:41:16 (GMT) |
commit | 8250e23abd12da20fcb03e2314fe6c34b403b534 (patch) | |
tree | 74edbbc78231eeaebbc548a15e25cf95ba0e7061 /Lib/test/test_posix.py | |
parent | f65132de3d00171b74bc81791cacc5abdbafe3e4 (diff) | |
download | cpython-8250e23abd12da20fcb03e2314fe6c34b403b534.zip cpython-8250e23abd12da20fcb03e2314fe6c34b403b534.tar.gz cpython-8250e23abd12da20fcb03e2314fe6c34b403b534.tar.bz2 |
Issue #10755: Add the posix.fdlistdir() function. Patch by Ross Lagerwall.
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)) |