(merge 3.2) Issue #12400: don't use sys.stderr in test_kqueue because it may be

replaced by a io.StringIO object by regrtest (which has no file descriptor).
This commit is contained in:
Victor Stinner 2011-06-29 14:59:46 +02:00
commit 7348c6bbb6
1 changed files with 4 additions and 1 deletions

View File

@ -23,7 +23,10 @@ class TestKQueue(unittest.TestCase):
def test_create_event(self): def test_create_event(self):
from operator import lt, le, gt, ge from operator import lt, le, gt, ge
fd = sys.stderr.fileno()
fd = os.open(os.devnull, os.O_WRONLY)
self.addCleanup(os.close, fd)
ev = select.kevent(fd) ev = select.kevent(fd)
other = select.kevent(1000) other = select.kevent(1000)
self.assertEqual(ev.ident, fd) self.assertEqual(ev.ident, fd)