diff options
author | Victor Stinner <vstinner@wyplay.com> | 2013-08-28 12:25:40 +0200 |
---|---|---|
committer | Victor Stinner <vstinner@wyplay.com> | 2013-08-28 12:25:40 +0200 |
commit | a2405a2e9010169dda6cd41d7077044e01bfbd3d (patch) | |
tree | 32cce6fcfc564179516f430bcca994bd3ce91a12 /Lib | |
parent | 1f850d4517e4bf84e59a4b3b995445d4d8b4ed6a (diff) | |
download | cpython-a2405a2e9010169dda6cd41d7077044e01bfbd3d.tar.gz |
test_posix.test_pipe2() now checks that the O_NONBLOCK flag is set
Use also os.get_inheritable() instead of fcntl() to check the inheritable flag
(FD_CLOEXEC).
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_posix.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 3fd8f115cb..6cd3393a63 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -563,8 +563,10 @@ class PosixTester(unittest.TestCase): r, w = os.pipe2(os.O_CLOEXEC|os.O_NONBLOCK) self.addCleanup(os.close, r) self.addCleanup(os.close, w) - self.assertTrue(fcntl.fcntl(r, fcntl.F_GETFD) & fcntl.FD_CLOEXEC) - self.assertTrue(fcntl.fcntl(w, fcntl.F_GETFD) & fcntl.FD_CLOEXEC) + self.assertFalse(os.get_inheritable(r)) + self.assertFalse(os.get_inheritable(w)) + self.assertTrue(fcntl.fcntl(r, fcntl.F_GETFL) & os.O_NONBLOCK) + self.assertTrue(fcntl.fcntl(w, fcntl.F_GETFL) & os.O_NONBLOCK) # try reading from an empty pipe: this should fail, not block self.assertRaises(OSError, os.read, r, 1) # try a write big enough to fill-up the pipe: this should either |