11import pickle
22import unittest
3- from concurrent . futures import Future , ThreadPoolExecutor
3+ from concurrent import futures
44from time import sleep
55
66from bidict import ValueDuplicationError
@@ -175,7 +175,7 @@ def test_with_executor(self):
175175 wf .b = wf .create .function_node (plus_one , x = wf .a )
176176
177177 original_a = wf .a
178- wf .executor = wf . create .ProcessPoolExecutor ()
178+ wf .executor = futures .ProcessPoolExecutor ()
179179
180180 self .assertIs (
181181 NOT_DATA ,
@@ -185,7 +185,7 @@ def test_with_executor(self):
185185
186186 result = wf (a__x = 0 )
187187 self .assertIsInstance (
188- result , Future , msg = "Should be running as a parallel process"
188+ result , futures . Future , msg = "Should be running as a parallel process"
189189 )
190190
191191 _ = result .result (timeout = 120 ) # Wait for the process to finish
@@ -215,7 +215,7 @@ def test_run_in_thread_exceptions(self):
215215 wf = Workflow ("wf" )
216216 wf .a = wf .create .function_node (plus_one )
217217
218- wf .executor = (ThreadPoolExecutor , (), {})
218+ wf .executor = (futures . ThreadPoolExecutor , (), {})
219219
220220 with self .assertRaises (
221221 ValueError ,
@@ -230,7 +230,7 @@ def test_parallel_execution(self):
230230 wf .fast = five ()
231231 wf .sum = sum (a = wf .fast , b = wf .slow )
232232
233- wf .slow .executor = wf . create .ProcessPoolExecutor ()
233+ wf .slow .executor = futures .ProcessPoolExecutor ()
234234
235235 wf .slow .run ()
236236 wf .fast .run ()
@@ -405,15 +405,15 @@ def add_three_macro(self, one__x):
405405 msg = "Sanity check, pulling here should work perfectly fine" ,
406406 )
407407
408- wf .m .one .executor = wf . create .ProcessPoolExecutor ()
408+ wf .m .one .executor = futures .ProcessPoolExecutor ()
409409 with self .assertRaises (
410410 ValueError , msg = "Should not be able to pull with executor in local scope"
411411 ):
412412 wf .m .two .pull ()
413413 wf .m .one .executor_shutdown () # Shouldn't get this far, but if so, shutdown
414414 wf .m .one .executor = None
415415
416- wf .n1 .executor = wf . create .ProcessPoolExecutor ()
416+ wf .n1 .executor = futures .ProcessPoolExecutor ()
417417 with self .assertRaises (
418418 ValueError , msg = "Should not be able to pull with executor in parent scope"
419419 ):
0 commit comments