From: Victor Stinner Date: Wed, 29 Jun 2011 12:59:10 +0000 (+0200) Subject: Issue #12400: don't use sys.stderr in test_kqueue because it may be replaced by X-Git-Tag: v3.2.2rc1~185 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=46b209114655d1decbee42062102f47da63b2afe;p=python 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). --- diff --git a/Lib/test/test_kqueue.py b/Lib/test/test_kqueue.py index 9cb0a85166..5c9f7c9cea 100644 --- a/Lib/test/test_kqueue.py +++ b/Lib/test/test_kqueue.py @@ -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)