Commits

Ralf Schmitt committed 1750d2f

create a pipe instead of select'ing on sys.stdin in test__select.py

this makes test__select.py compatible with py.test and makes it
possible to run test__select.py with stdin redirected.

Comments (0)

Files changed (1)

greentest/test__select.py

 import sys
+import os
 from gevent import select, socket
 import greentest
 
     class TestSelectRead(greentest.GenericWaitTestCase):
 
         def wait(self, timeout):
-            select.select([sys.stdin.fileno()], [], [], timeout)
+            r, w = os.pipe()
+            try:
+                select.select([r], [], [], timeout)
+            finally:
+                os.close(r)
+                os.close(w)
 
 
 class TestSelectTypes(greentest.TestCase):