Commit ce5c8fc3 authored by Martín Ferrari's avatar Martín Ferrari

Add test for poll

parent 12450b7c
...@@ -109,6 +109,16 @@ class TestSubprocess(unittest.TestCase): ...@@ -109,6 +109,16 @@ class TestSubprocess(unittest.TestCase):
self.assertEquals(_readall(r), "hello world\n") self.assertEquals(_readall(r), "hello world\n")
os.close(r) os.close(r)
# Check poll.
while True:
ret = sp.poll(p)
if ret is not None:
self.assertEquals(ret, 0)
break
time.sleep(0.2) # Wait a little bit.
# It cannot be wait()ed again.
self.assertRaises(OSError, sp.wait, p)
r0, w0 = os.pipe() r0, w0 = os.pipe()
r1, w1 = os.pipe() r1, w1 = os.pipe()
p = sp.spawn('/bin/cat', stdout = w0, stdin = r1, close_fds = [r0, w1]) p = sp.spawn('/bin/cat', stdout = w0, stdin = r1, close_fds = [r0, w1])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment