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

Side by Side Diff: Lib/test/test_poll.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_platform.py ('k') | Lib/test/test_popen.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 # Test case for the os.poll() function 1 # Test case for the os.poll() function
2 2
3 import os 3 import os
4 import subprocess 4 import subprocess
5 import random 5 import random
6 import select 6 import select
7 try: 7 try:
8 import threading 8 import threading
9 except ImportError: 9 except ImportError:
10 threading = None 10 threading = None
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 class Almost: 114 class Almost:
115 def fileno(self): 115 def fileno(self):
116 return 'fileno' 116 return 'fileno'
117 117
118 self.assertRaises(TypeError, pollster.register, Nope(), 0) 118 self.assertRaises(TypeError, pollster.register, Nope(), 0)
119 self.assertRaises(TypeError, pollster.register, Almost(), 0) 119 self.assertRaises(TypeError, pollster.register, Almost(), 0)
120 120
121 # Another test case for poll(). This is copied from the test case for 121 # Another test case for poll(). This is copied from the test case for
122 # select(), modified to use poll() instead. 122 # select(), modified to use poll() instead.
123 123
124 @unittest.skipUnless(hasattr(subprocess, 'Popen'), "test requires subprocess .Popen()")
124 def test_poll2(self): 125 def test_poll2(self):
125 cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done' 126 cmd = 'for i in 0 1 2 3 4 5 6 7 8 9; do echo testing...; sleep 1; done'
126 proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, 127 proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
127 bufsize=0) 128 bufsize=0)
128 p = proc.stdout 129 p = proc.stdout
129 pollster = select.poll() 130 pollster = select.poll()
130 pollster.register( p, select.POLLIN ) 131 pollster.register( p, select.POLLIN )
131 for tout in (0, 1000, 2000, 4000, 8000, 16000) + (-1,)*10: 132 for tout in (0, 1000, 2000, 4000, 8000, 16000) + (-1,)*10:
132 fdlist = pollster.poll(tout) 133 fdlist = pollster.poll(tout)
133 if (fdlist == []): 134 if (fdlist == []):
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 # and make the call to poll() from the thread return 207 # and make the call to poll() from the thread return
207 os.write(w, b'spam') 208 os.write(w, b'spam')
208 t.join() 209 t.join()
209 210
210 211
211 def test_main(): 212 def test_main():
212 run_unittest(PollTests) 213 run_unittest(PollTests)
213 214
214 if __name__ == '__main__': 215 if __name__ == '__main__':
215 test_main() 216 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_platform.py ('k') | Lib/test/test_popen.py » ('j') | no next file with comments »

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