summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2009-07-22 17:37:11 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2009-07-22 17:37:11 (GMT)
commitce28a01e350bee803bbddab873090e59fb9d0c4c (patch)
treea923763fa8f75109b64f2d6282f66ceae6058a56
parent11a81b21518a263aea9642f29cbd9e78326982a6 (diff)
downloadcpython-ce28a01e350bee803bbddab873090e59fb9d0c4c.zip
cpython-ce28a01e350bee803bbddab873090e59fb9d0c4c.tar.gz
cpython-ce28a01e350bee803bbddab873090e59fb9d0c4c.tar.bz2
Merged revisions 74175 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r74175 | r.david.murray | 2009-07-22 13:22:58 -0400 (Wed, 22 Jul 2009) | 4 lines Backport of fix for issue 6542: make sure test_os.TestInvalidFD.test_closerange does not close any valid file descriptors. ........
-rw-r--r--Lib/test/test_os.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 909e0ab..6d90f84 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -556,7 +556,18 @@ class TestInvalidFD(unittest.TestCase):
def test_closerange(self):
if hasattr(os, "closerange"):
fd = test_support.make_bad_fd()
- self.assertEqual(os.closerange(fd, fd + 10), None)
+ # Make sure none of the descriptors we are about to close are
+ # currently valid (issue 6542).
+ for i in range(10):
+ try: os.fstat(fd+i)
+ except OSError:
+ pass
+ else:
+ break
+ if i < 2:
+ raise unittest.SkipTest(
+ "Unable to acquire a range of invalid file descriptors")
+ self.assertEqual(os.closerange(fd, fd + i-1), None)
def test_dup2(self):
if hasattr(os, "dup2"):