annotate Lib/test/test_select.py @ 4566:6403c94de50d legacy-trunk

Added safeguard against failure in __del__.
author Guido van Rossum <guido@python.org>
date Wed, 27 Nov 1996 19:39:58 +0000
parents d6f6a1cb7d79
children 8015c5549309
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1407
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
1 # Testing select module
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
2
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
3 def test():
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
4 import select
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
5 import os
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
6 cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do date; sleep 3; done'
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
7 p = os.popen(cmd, 'r')
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
8 for tout in (0, 1, 2, 4, 8, 16) + (None,)*10:
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
9 print 'timeout =', tout
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
10 rfd, wfd, xfd = select.select([p], [], [], tout)
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
11 print rfd, wfd, xfd
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
12 if (rfd, wfd, xfd) == ([], [], []):
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
13 continue
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
14 if (rfd, wfd, xfd) == ([p], [], []):
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
15 line = p.readline()
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
16 print `line`
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
17 if not line:
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
18 print 'EOF'
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
19 break
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
20 continue
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
21 print 'Heh?'
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
22
b9fcfb99a3e5 * test_select.py: (some) tests for built-in select module
Guido van Rossum <guido@python.org>
parents:
diff changeset
23 test()