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

Side by Side Diff: Lib/test/test_thread.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_threading.py ('k') | Lib/test/test_traceback.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 os 1 import os
2 import unittest 2 import unittest
3 import random 3 import random
4 from test import support 4 from test import support
5 thread = support.import_module('_thread') 5 thread = support.import_module('_thread')
6 import time 6 import time
7 import sys 7 import sys
8 import weakref 8 import weakref
9 9
10 from test import lock_tests 10 from test import lock_tests
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 class LockTests(lock_tests.LockTests): 212 class LockTests(lock_tests.LockTests):
213 locktype = thread.allocate_lock 213 locktype = thread.allocate_lock
214 214
215 215
216 class TestForkInThread(unittest.TestCase): 216 class TestForkInThread(unittest.TestCase):
217 def setUp(self): 217 def setUp(self):
218 self.read_fd, self.write_fd = os.pipe() 218 self.read_fd, self.write_fd = os.pipe()
219 219
220 @unittest.skipIf(sys.platform.startswith('win'), 220 @unittest.skipIf(sys.platform.startswith('win'),
221 "This test is only appropriate for POSIX-like systems.") 221 "This test is only appropriate for POSIX-like systems.")
222 @unittest.skipUnless(hasattr(os, 'fork'), "test requires os.fork()")
222 @support.reap_threads 223 @support.reap_threads
223 def test_forkinthread(self): 224 def test_forkinthread(self):
224 def thread1(): 225 def thread1():
225 try: 226 try:
226 pid = os.fork() # fork in a thread 227 pid = os.fork() # fork in a thread
227 except RuntimeError: 228 except RuntimeError:
228 os._exit(1) # exit the child 229 os._exit(1) # exit the child
229 230
230 if pid == 0: # child 231 if pid == 0: # child
231 try: 232 try:
(...skipping 15 matching lines...) Expand all
247 pass 248 pass
248 249
249 try: 250 try:
250 os.close(self.write_fd) 251 os.close(self.write_fd)
251 except OSError: 252 except OSError:
252 pass 253 pass
253 254
254 255
255 if __name__ == "__main__": 256 if __name__ == "__main__":
256 unittest.main() 257 unittest.main()
OLDNEW
« no previous file with comments | « Lib/test/test_threading.py ('k') | Lib/test/test_traceback.py » ('j') | no next file with comments »

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