summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorCharles-François Natali <neologix@free.fr>2011-05-22 18:42:32 (GMT)
committerCharles-François Natali <neologix@free.fr>2011-05-22 18:42:32 (GMT)
commit1e045b183104df770e232e756986bf301c87e9ce (patch)
treec32a523ffd41a155df1e3f2e8be2860970617ab0 /Lib/test
parentf738d33e5d5cfa19938003af4a57f91b5e5e277b (diff)
downloadcpython-1e045b183104df770e232e756986bf301c87e9ce.zip
cpython-1e045b183104df770e232e756986bf301c87e9ce.tar.gz
cpython-1e045b183104df770e232e756986bf301c87e9ce.tar.bz2
Issue #12105: Add O_CLOEXEC to the os module.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_posix.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 0e9ac75..9c2cac3 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -9,6 +9,7 @@ import errno
import sys
import time
import os
+import fcntl
import pwd
import shutil
import stat
@@ -307,6 +308,12 @@ class PosixTester(unittest.TestCase):
fp1.close()
fp2.close()
+ @unittest.skipUnless(hasattr(os, 'O_CLOEXEC'), "needs os.O_CLOEXEC")
+ def test_oscloexec(self):
+ fd = os.open(support.TESTFN, os.O_RDONLY|os.O_CLOEXEC)
+ self.addCleanup(os.close, fd)
+ self.assertTrue(fcntl.fcntl(fd, fcntl.F_GETFD) & fcntl.FD_CLOEXEC)
+
def test_osexlock(self):
if hasattr(posix, "O_EXLOCK"):
fd = os.open(support.TESTFN,