summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_posix.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@wyplay.com>2013-08-28 10:25:40 (GMT)
committerVictor Stinner <vstinner@wyplay.com>2013-08-28 10:25:40 (GMT)
commitbff989ed201d9b566881705aa876300845390a7d (patch)
tree304fcde7e2b59f30f95d551a271d1e403c370944 /Lib/test/test_posix.py
parentd72fe89b800cf8ce66b742c16e93345361976ee6 (diff)
downloadcpython-bff989ed201d9b566881705aa876300845390a7d.zip
cpython-bff989ed201d9b566881705aa876300845390a7d.tar.gz
cpython-bff989ed201d9b566881705aa876300845390a7d.tar.bz2
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/test/test_posix.py')
-rw-r--r--Lib/test/test_posix.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 3fd8f11..6cd3393 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