Closes #21527: Add default number of workers to ThreadPoolExecutor. (Claudiu Popa.)

This commit is contained in:
Guido van Rossum 2014-09-02 10:39:18 -07:00
parent 8257b6283e
commit cfd4661e78
4 changed files with 24 additions and 2 deletions

View file

@ -11,6 +11,7 @@ test.support.import_module('threading')
from test.script_helper import assert_python_ok
import os
import sys
import threading
import time
@ -444,6 +445,11 @@ class ThreadPoolExecutorTest(ThreadPoolMixin, ExecutorTest, unittest.TestCase):
self.executor.shutdown(wait=True)
self.assertCountEqual(finished, range(10))
def test_default_workers(self):
executor = self.executor_type()
self.assertEqual(executor._max_workers,
(os.cpu_count() or 1) * 5)
class ProcessPoolExecutorTest(ProcessPoolMixin, ExecutorTest, unittest.TestCase):
def test_killed_child(self):