File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed
Lib/test/test_concurrent_futures Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -358,6 +358,7 @@ def test_blocking(self):
358
358
blocker = queues .create ()
359
359
360
360
def run (ready , blocker ):
361
+ raise Exception ((ready .id , blocker .id ))
361
362
ready .put (None )
362
363
blocker .get () # blocking
363
364
@@ -368,12 +369,24 @@ def run(ready, blocker):
368
369
for i in range (numtasks ):
369
370
fut = executor .submit (run , ready , blocker )
370
371
futures .append (fut )
371
- # Wait for them all to be ready.
372
- for i in range (numtasks ):
373
- ready .get () # blocking
374
- # Unblock the workers.
375
- for i in range (numtasks ):
376
- blocker .put_nowait (None )
372
+ assert len (executor ._threads ) == numtasks , len (executor ._threads )
373
+ ctx = None
374
+ for i , fut in enumerate (futures , 1 ):
375
+ try :
376
+ fut .result (timeout = 10 )
377
+ except Exception as exc :
378
+ exc .__cause__ = ctx
379
+ ctx = exc
380
+ if i == numtasks :
381
+ raise Exception ((ready .id , blocker .id ))
382
+ # try:
383
+ # # Wait for them all to be ready.
384
+ # for i in range(numtasks):
385
+ # ready.get() # blocking
386
+ # finally:
387
+ # # Unblock the workers.
388
+ # for i in range(numtasks):
389
+ # blocker.put_nowait(None)
377
390
finally :
378
391
executor .shutdown (wait = True )
379
392
You can’t perform that action at this time.
0 commit comments