]> granicus.if.org Git - python/commitdiff
Issue #12400: don't use sys.stderr in test_kqueue because it may be replaced by
authorVictor Stinner <victor.stinner@haypocalc.com>
Wed, 29 Jun 2011 12:59:10 +0000 (14:59 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Wed, 29 Jun 2011 12:59:10 +0000 (14:59 +0200)
a io.StringIO object by regrtest (which has no file descriptor).

Lib/test/test_kqueue.py

index 9cb0a85166f831088d6c97c6f4ee3995947f996e..5c9f7c9ceafcec35996dced16df0bc28ecc7c69b 100644 (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)