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:10 +02:00
parent bd98f9367c
commit 46b2091146
1 changed files with 4 additions and 1 deletions

View File

@ -23,7 +23,10 @@ class TestKQueue(unittest.TestCase):
def test_create_event(self):
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)
other = select.kevent(1000)
self.assertEqual(ev.ident, fd)