summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_poll.py
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2000-08-29 16:53:34 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2000-08-29 16:53:34 (GMT)
commitd50a1877ee51a275a132c05d89bac12958811a5d (patch)
treebbbae0ab345e36a6813486f71171d19a227cf8b2 /Lib/test/test_poll.py
parent78430b655fc7e8afd537644a97e24dc546fa473d (diff)
downloadcpython-d50a1877ee51a275a132c05d89bac12958811a5d.zip
cpython-d50a1877ee51a275a132c05d89bac12958811a5d.tar.gz
cpython-d50a1877ee51a275a132c05d89bac12958811a5d.tar.bz2
Fix for two problems on FreeBSD:
In test_poll1(), unregister file descriptors as they're closed, and also close the read end of the pipe In test_poll2(), make the code assume less about the combinations of flag bits that will be returned
Diffstat (limited to 'Lib/test/test_poll.py')
-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 543dc6b..82d8372 100644
--- a/Lib/test/test_poll.py
+++ b/Lib/test/test_poll.py
@@ -57,7 +57,9 @@ def test_poll1():
buf = os.read(rd, MSG_LEN)
assert len(buf) == MSG_LEN
print buf
- os.close(r2w[rd])
+ os.close(r2w[rd]) ; os.close( rd )
+ p.unregister( r2w[rd] )
+ p.unregister( rd )
writers.remove(r2w[rd])
poll_unit_tests()
@@ -145,13 +147,14 @@ def test_poll2():
fdlist = pollster.poll(tout)
if (fdlist == []):
continue
- if fdlist[0] == (p.fileno(),select.POLLHUP):
+ fd, flags = fdlist[0]
+ if flags & select.POLLHUP:
line = p.readline()
if line != "":
print 'error: pipe seems to be closed, but still returns data'
continue
- elif fdlist[0] == (p.fileno(),select.POLLIN):
+ elif flags & select.POLLIN:
line = p.readline()
if verbose:
print `line`