summaryrefslogtreecommitdiff
path: root/Lib/test/test_os.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-01-19 20:22:13 +0000
committerGeorg Brandl <georg@python.org>2008-01-19 20:22:13 +0000
commit309501a61772f4cb72f1004fcbe73964b4130672 (patch)
tree8737924e043d901d7c62910a97c6aebdd8e62f8e /Lib/test/test_os.py
parent15ce880cc8c3de29e91e2e867b2db0b19a48e5f3 (diff)
downloadcpython-git-309501a61772f4cb72f1004fcbe73964b4130672.tar.gz
#1663329: add os.closerange() to close a range of fds,
ignoring errors, and use this in subprocess to speed up subprocess creation in close_fds mode. Patch by Mike Klaas.
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r--Lib/test/test_os.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 52fdd8a4df..a6fe40e830 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -23,6 +23,12 @@ class FileTests(unittest.TestCase):
os.close(f)
self.assert_(os.access(test_support.TESTFN, os.W_OK))
+ def test_closerange(self):
+ f = os.open(test_support.TESTFN, os.O_CREAT|os.O_RDWR)
+ # close a fd that is open, and one that isn't
+ os.closerange(f, f+2)
+ self.assertRaises(OSError, os.write, f, "a")
+
class TemporaryFileTests(unittest.TestCase):
def setUp(self):