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

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

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 11 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_compileall.py ('k') | Lib/test/test_copy.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 test.support 1 import test.support
2 2
3 # Skip tests if _multiprocessing wasn't built. 3 # Skip tests if _multiprocessing wasn't built.
4 test.support.import_module('_multiprocessing') 4 test.support.import_module('_multiprocessing')
5 # Skip tests if sem_open implementation is broken. 5 # Skip tests if sem_open implementation is broken.
6 test.support.import_module('multiprocessing.synchronize') 6 test.support.import_module('multiprocessing.synchronize')
7 # import threading after _multiprocessing to raise a more revelant error 7 # import threading after _multiprocessing to raise a more revelant error
8 # message: "No module named _multiprocessing". _multiprocessing is not compiled 8 # message: "No module named _multiprocessing". _multiprocessing is not compiled
9 # without thread support. 9 # without thread support.
10 test.support.import_module('threading') 10 test.support.import_module('threading')
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 for i in self.executor.map(time.sleep, 359 for i in self.executor.map(time.sleep,
360 [0, 0, 6], 360 [0, 0, 6],
361 timeout=5): 361 timeout=5):
362 results.append(i) 362 results.append(i)
363 except futures.TimeoutError: 363 except futures.TimeoutError:
364 pass 364 pass
365 else: 365 else:
366 self.fail('expected TimeoutError') 366 self.fail('expected TimeoutError')
367 367
368 self.assertEqual([None, None], results) 368 self.assertEqual([None, None], results)
369
370 def test_shutdown_race_issue12456(self):
371 # Issue #12456: race condition at shutdown where trying to post a
372 # sentinel in the call queue blocks (the queue is full while processes
373 # have exited).
374 self.executor.map(str, [2] * (self.worker_count + 1))
375 self.executor.shutdown()
376 369
377 370
378 class ThreadPoolExecutorTest(ThreadPoolMixin, ExecutorTest): 371 class ThreadPoolExecutorTest(ThreadPoolMixin, ExecutorTest):
379 def test_map_submits_without_iteration(self): 372 def test_map_submits_without_iteration(self):
380 """Tests verifying issue 11777.""" 373 """Tests verifying issue 11777."""
381 finished = [] 374 finished = []
382 def record_finished(n): 375 def record_finished(n):
383 finished.append(n) 376 finished.append(n)
384 377
385 self.executor.map(record_finished, range(10)) 378 self.executor.map(record_finished, range(10))
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 f1._state = FINISHED 609 f1._state = FINISHED
617 f1._exception = IOError() 610 f1._exception = IOError()
618 f1._condition.notify_all() 611 f1._condition.notify_all()
619 612
620 f1 = create_future(state=PENDING) 613 f1 = create_future(state=PENDING)
621 t = threading.Thread(target=notification) 614 t = threading.Thread(target=notification)
622 t.start() 615 t.start()
623 616
624 self.assertTrue(isinstance(f1.exception(timeout=5), IOError)) 617 self.assertTrue(isinstance(f1.exception(timeout=5), IOError))
625 618
626 @test.support.reap_threads
627 def test_main(): 619 def test_main():
628 try: 620 test.support.run_unittest(ProcessPoolExecutorTest,
629 test.support.run_unittest(ProcessPoolExecutorTest, 621 ThreadPoolExecutorTest,
630 ThreadPoolExecutorTest, 622 ProcessPoolWaitTests,
631 ProcessPoolWaitTests, 623 ThreadPoolWaitTests,
632 ThreadPoolWaitTests, 624 ProcessPoolAsCompletedTests,
633 ProcessPoolAsCompletedTests, 625 ThreadPoolAsCompletedTests,
634 ThreadPoolAsCompletedTests, 626 FutureTests,
635 FutureTests, 627 ProcessPoolShutdownTest,
636 ProcessPoolShutdownTest, 628 ThreadPoolShutdownTest)
637 ThreadPoolShutdownTest,
638 )
639 finally:
640 test.support.reap_children()
641 629
642 if __name__ == "__main__": 630 if __name__ == "__main__":
643 test_main() 631 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_compileall.py ('k') | Lib/test/test_copy.py » ('j') | no next file with comments »

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