diff options
author | R. David Murray <rdmurray@bitdance.com> | 2009-07-22 15:23:36 (GMT) |
---|---|---|
committer | R. David Murray <rdmurray@bitdance.com> | 2009-07-22 15:23:36 (GMT) |
commit | 1f1b9a48e771cf00622f7a9c2318cf6f57a3395e (patch) | |
tree | 01f83877328f1aa840cd97dc0a15e7581d456c61 | |
parent | 069bcc3dd99be9d4a0ea2202377066c0a77de651 (diff) | |
download | cpython-1f1b9a48e771cf00622f7a9c2318cf6f57a3395e.zip cpython-1f1b9a48e771cf00622f7a9c2318cf6f57a3395e.tar.gz cpython-1f1b9a48e771cf00622f7a9c2318cf6f57a3395e.tar.bz2 |
Merged revisions 74171 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r74171 | r.david.murray | 2009-07-22 11:20:27 -0400 (Wed, 22 Jul 2009) | 3 lines
Issue 6542: Make sure that TestInvalidFD.test_closerange does not
close any valid file descriptors.
........
-rw-r--r-- | Lib/test/test_os.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 0600cfc..9e60f00 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -617,7 +617,18 @@ class TestInvalidFD(unittest.TestCase): def test_closerange(self): if hasattr(os, "closerange"): fd = 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"): |