File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 1717from operator import add , floordiv , mul , sub
1818from pprint import pprint
1919from textwrap import dedent
20+ from time import sleep
2021from typing import Tuple
2122from unittest .mock import MagicMock
2223
@@ -308,22 +309,27 @@ def powers_in_range(a, exponent):
308309
309310def test_task_context (exemethod , request ):
310311 def check_task_context ():
311- assert task_context .get ().op == next (iop )
312+ sleep (0.1 )
313+ assert task_context .get ().op == next (iop ), "Corrupted task-context"
312314
313- n_ops = 30
315+ n_ops = 10
314316 pipe = compose (
315317 "t" ,
316- * (operation (check_task_context , f"op{ i } " , provides = "a" ) for i in range (n_ops )),
318+ * (
319+ operation (check_task_context , f"op{ i } " , provides = f"{ i } " )
320+ for i in range (n_ops )
321+ ),
317322 parallel = exemethod ,
318323 )
319324 iop = iter (pipe .ops )
320325
321326 print (_exe_params )
322327 err = None
323- if _exe_params .parallel and _exe_params .marshal :
324- err = AssertionError ("^assert FunctionalOperation" )
325328 if _exe_params .proc and _exe_params .marshal :
326329 err = Exception ("^Error sending result" )
330+ elif _exe_params .parallel :
331+ err = AssertionError ("^Corrupted task-context" )
332+
327333 if err :
328334 with pytest .raises (type (err ), match = str (err )):
329335 pipe .compute ()
You can’t perform that action at this time.
0 commit comments