Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3f0376db
Commit
3f0376db
authored
Dec 09, 2012
by
Richard Oudkerk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make test of poll() use unbuffered IO
parent
ff98b3f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
Lib/test/test_poll.py
Lib/test/test_poll.py
+6
-3
No files found.
Lib/test/test_poll.py
View file @
3f0376db
# Test case for the os.poll() function
# 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
from
test.support
import
TESTFN
,
run_unittest
try
:
try
:
...
@@ -114,7 +114,9 @@ class PollTests(unittest.TestCase):
...
@@ -114,7 +114,9 @@ class PollTests(unittest.TestCase):
def
test_poll2
(
self
):
def
test_poll2
(
self
):
cmd
=
'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done'
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
=
select
.
poll
()
pollster
.
register
(
p
,
select
.
POLLIN
)
pollster
.
register
(
p
,
select
.
POLLIN
)
for
tout
in
(
0
,
1000
,
2000
,
4000
,
8000
,
16000
)
+
(
-
1
,)
*
10
:
for
tout
in
(
0
,
1000
,
2000
,
4000
,
8000
,
16000
)
+
(
-
1
,)
*
10
:
...
@@ -124,7 +126,7 @@ class PollTests(unittest.TestCase):
...
@@ -124,7 +126,7 @@ class PollTests(unittest.TestCase):
fd
,
flags
=
fdlist
[
0
]
fd
,
flags
=
fdlist
[
0
]
if
flags
&
select
.
POLLHUP
:
if
flags
&
select
.
POLLHUP
:
line
=
p
.
readline
()
line
=
p
.
readline
()
if
line
!=
""
:
if
line
!=
b
""
:
self
.
fail
(
'error: pipe seems to be closed, but still returns data'
)
self
.
fail
(
'error: pipe seems to be closed, but still returns data'
)
continue
continue
...
@@ -132,6 +134,7 @@ class PollTests(unittest.TestCase):
...
@@ -132,6 +134,7 @@ class PollTests(unittest.TestCase):
line
=
p
.
readline
()
line
=
p
.
readline
()
if
not
line
:
if
not
line
:
break
break
self
.
assertEqual
(
line
,
b'testing...
\
n
'
)
continue
continue
else
:
else
:
self
.
fail
(
'Unexpected return value from select.poll: %s'
%
fdlist
)
self
.
fail
(
'Unexpected return value from select.poll: %s'
%
fdlist
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment