summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorRichard Oudkerk <shibturn@gmail.com>2012-12-09 16:05:22 (GMT)
committerRichard Oudkerk <shibturn@gmail.com>2012-12-09 16:05:22 (GMT)
commit07c34bf19f0dad2d9780e213f462882932b79429 (patch)
treec21e57085561e0164cd824d3a8035e86203c6191 /Lib/test
parent53dff0c059f21945d1fb2bf2b33621205137a455 (diff)
downloadcpython-07c34bf19f0dad2d9780e213f462882932b79429.zip
cpython-07c34bf19f0dad2d9780e213f462882932b79429.tar.gz
cpython-07c34bf19f0dad2d9780e213f462882932b79429.tar.bz2
Make test of poll() use unbuffered IO
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_poll.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/test/test_poll.py b/Lib/test/test_poll.py
index d0e4f32..3b7926d 100644
--- a/Lib/test/test_poll.py
+++ b/Lib/test/test_poll.py
@@ -1,6 +1,6 @@
# Test case for the os.poll() function
-import os, select, random, unittest
+import os, select, random, unittest, subprocess
from test.support import TESTFN, run_unittest
try:
@@ -114,7 +114,9 @@ class PollTests(unittest.TestCase):
def test_poll2(self):
cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done'
- p = os.popen(cmd, 'r')
+ proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
+ bufsize=0)
+ p = proc.stdout
pollster = select.poll()
pollster.register( p, select.POLLIN )
for tout in (0, 1000, 2000, 4000, 8000, 16000) + (-1,)*10:
@@ -124,7 +126,7 @@ class PollTests(unittest.TestCase):
fd, flags = fdlist[0]
if flags & select.POLLHUP:
line = p.readline()
- if line != "":
+ if line != b"":
self.fail('error: pipe seems to be closed, but still returns data')
continue
@@ -132,6 +134,7 @@ class PollTests(unittest.TestCase):
line = p.readline()
if not line:
break
+ self.assertEqual(line, b'testing...\n')
continue
else:
self.fail('Unexpected return value from select.poll: %s' % fdlist)