1 # Testing select module
2 from test
.test_support
import verbose
6 # test some known error conditions
8 rfd
, wfd
, xfd
= select
.select(1, 2, 3)
12 print 'expected TypeError exception not raised'
22 rfd
, wfd
, xfd
= select
.select([Nope()], [], [])
26 print 'expected TypeError exception not raised'
29 rfd
, wfd
, xfd
= select
.select([Almost()], [], [])
33 print 'expected TypeError exception not raised'
36 rfd
, wfd
, xfd
= select
.select([], [], [], 'not a number')
40 print 'expected TypeError exception not raised'
45 if sys
.platform
[:3] in ('win', 'mac', 'os2'):
47 print "Can't test select easily on", sys
.platform
49 cmd
= 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done'
50 p
= os
.popen(cmd
, 'r')
51 for tout
in (0, 1, 2, 4, 8, 16) + (None,)*10:
53 print 'timeout =', tout
54 rfd
, wfd
, xfd
= select
.select([p
], [], [], tout
)
55 if (rfd
, wfd
, xfd
) == ([], [], []):
57 if (rfd
, wfd
, xfd
) == ([p
], [], []):
66 print 'Unexpected return values from select():', rfd
, wfd
, xfd