@@ -234,21 +234,21 @@ def mock_start_new_thread(func, *args, **kwargs):
234234 executor .shutdown ()
235235
236236 def test_terminate_workers (self ):
237- with futures . ProcessPoolExecutor (max_workers = 1 ) as executor :
237+ with self . executor_type (max_workers = 1 ) as executor :
238238 executor ._force_shutdown = unittest .mock .Mock ()
239239 executor .terminate_workers ()
240240
241241 executor ._force_shutdown .assert_called_once_with (operation = futures .process ._TERMINATE )
242242
243243 def test_kill_workers (self ):
244- with futures . ProcessPoolExecutor (max_workers = 1 ) as executor :
244+ with self . executor_type (max_workers = 1 ) as executor :
245245 executor ._force_shutdown = unittest .mock .Mock ()
246246 executor .kill_workers ()
247247
248248 executor ._force_shutdown .assert_called_once_with (operation = futures .process ._KILL )
249249
250250 def test_force_shutdown_workers_invalid_op (self ):
251- with futures . ProcessPoolExecutor (max_workers = 1 ) as executor :
251+ with self . executor_type (max_workers = 1 ) as executor :
252252 self .assertRaises (ValueError ,
253253 executor ._force_shutdown ,
254254 operation = 'invalid operation' ),
@@ -258,7 +258,7 @@ def test_force_shutdown_workers(self, function_name):
258258 manager = self .get_context ().Manager ()
259259 q = manager .Queue ()
260260
261- with futures . ProcessPoolExecutor (max_workers = 1 ) as executor :
261+ with self . executor_type (max_workers = 1 ) as executor :
262262 executor .submit (_put_sleep_put , q )
263263
264264 # We should get started, but not finished since we'll terminate the
@@ -280,7 +280,7 @@ def test_force_shutdown_workers(self, function_name):
280280
281281 @parameterize (* FORCE_SHUTDOWN_PARAMS )
282282 def test_force_shutdown_workers_dead_workers (self , function_name ):
283- with futures . ProcessPoolExecutor (max_workers = 1 ) as executor :
283+ with self . executor_type (max_workers = 1 ) as executor :
284284 future = executor .submit (os ._exit , 1 )
285285 self .assertRaises (BrokenProcessPool , future .result )
286286
@@ -291,7 +291,7 @@ def test_force_shutdown_workers_dead_workers(self, function_name):
291291 def test_force_shutdown_workers_not_started_yet (self , function_name ):
292292 ctx = self .get_context ()
293293 with unittest .mock .patch .object (ctx , 'Process' ) as mock_process :
294- with futures . ProcessPoolExecutor (max_workers = 1 , mp_context = ctx ) as executor :
294+ with self . executor_type (max_workers = 1 , mp_context = ctx ) as executor :
295295 # The worker has not been started yet, terminate/kill_workers
296296 # should basically no-op
297297 getattr (executor , function_name )()
@@ -301,7 +301,7 @@ def test_force_shutdown_workers_not_started_yet(self, function_name):
301301
302302 @parameterize (* FORCE_SHUTDOWN_PARAMS )
303303 def test_force_shutdown_workers_stops_pool (self , function_name ):
304- with futures . ProcessPoolExecutor (max_workers = 1 ) as executor :
304+ with self . executor_type (max_workers = 1 ) as executor :
305305 task = executor .submit (time .sleep , 0 )
306306 self .assertIsNone (task .result ())
307307
0 commit comments