Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(161761)

Side by Side Diff: Lib/test/test_select.py

Issue 23670: Modifications to support iOS as a development platform
Patch Set: Created 3 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_quopri.py ('k') | Lib/test/test_shutil.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import errno 1 import errno
2 import os 2 import os
3 import select 3 import select
4 import subprocess
4 import sys 5 import sys
5 import unittest 6 import unittest
6 from test import support 7 from test import support
7 8
8 @unittest.skipIf((sys.platform[:3]=='win'), 9 @unittest.skipIf((sys.platform[:3]=='win'),
9 "can't easily test on this system") 10 "can't easily test on this system")
10 class SelectTestCase(unittest.TestCase): 11 class SelectTestCase(unittest.TestCase):
11 12
12 class Nope: 13 class Nope:
13 pass 14 pass
(...skipping 23 matching lines...) Expand all
37 else: 38 else:
38 self.fail("exception not raised") 39 self.fail("exception not raised")
39 40
40 def test_returned_list_identity(self): 41 def test_returned_list_identity(self):
41 # See issue #8329 42 # See issue #8329
42 r, w, x = select.select([], [], [], 1) 43 r, w, x = select.select([], [], [], 1)
43 self.assertIsNot(r, w) 44 self.assertIsNot(r, w)
44 self.assertIsNot(r, x) 45 self.assertIsNot(r, x)
45 self.assertIsNot(w, x) 46 self.assertIsNot(w, x)
46 47
48 @unittest.skipUnless(hasattr(subprocess, 'Popen'), "test requires subprocess .Popen()")
47 def test_select(self): 49 def test_select(self):
48 cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done' 50 cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done'
49 p = os.popen(cmd, 'r') 51 p = os.popen(cmd, 'r')
50 for tout in (0, 1, 2, 4, 8, 16) + (None,)*10: 52 for tout in (0, 1, 2, 4, 8, 16) + (None,)*10:
51 if support.verbose: 53 if support.verbose:
52 print('timeout =', tout) 54 print('timeout =', tout)
53 rfd, wfd, xfd = select.select([p], [], [], tout) 55 rfd, wfd, xfd = select.select([p], [], [], tout)
54 if (rfd, wfd, xfd) == ([], [], []): 56 if (rfd, wfd, xfd) == ([], [], []):
55 continue 57 continue
56 if (rfd, wfd, xfd) == ([p], [], []): 58 if (rfd, wfd, xfd) == ([p], [], []):
(...skipping 16 matching lines...) Expand all
73 del a[-1] 75 del a[-1]
74 return sys.__stdout__.fileno() 76 return sys.__stdout__.fileno()
75 a[:] = [F()] * 10 77 a[:] = [F()] * 10
76 self.assertEqual(select.select([], a, []), ([], a[:5], [])) 78 self.assertEqual(select.select([], a, []), ([], a[:5], []))
77 79
78 def tearDownModule(): 80 def tearDownModule():
79 support.reap_children() 81 support.reap_children()
80 82
81 if __name__ == "__main__": 83 if __name__ == "__main__":
82 unittest.main() 84 unittest.main()
OLDNEW
« no previous file with comments | « Lib/test/test_quopri.py ('k') | Lib/test/test_shutil.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+