mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Closes #21527: Add default number of workers to ThreadPoolExecutor. (Claudiu Popa.)
This commit is contained in:
parent
8257b6283e
commit
cfd4661e78
4 changed files with 24 additions and 2 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue