def test_multi_pipeline_fail():
 group = worker.WalTransferGroup(FakeWalUploader())
 segments = list(prepare_multi_upload_segments())
 exp = Explosion('fail')
 fail_idx = 2
 segments[fail_idx]._upload_explosive = exp
 for seg in segments:
  group.start(seg)
 with pytest.raises(Explosion) as e:
  group.join()
 assert (e.value is exp)
 for (i, seg) in enumerate(segments):
  if (i == fail_idx):
   assert failed(seg)
  else:
   assert indeterminate(seg)

def test_multi_pipeline_fail ( ) : group = worker . WalTransferGroup ( FakeWalUploader ( ) ) segments = list ( prepare_multi_upload_segments ( ) ) exp = Explosion ( 'fail' ) fail_idx = 2 segments [ fail_idx ] . _upload_explosive = exp for seg in segments : group . start ( seg ) with pytest . raises ( Explosion ) as e : group . join ( ) assert ( e . value is exp ) for ( i , seg ) in enumerate ( segments ) : if ( i == fail_idx ) : assert failed ( seg ) else : assert indeterminate ( seg )
model a failure of the pipelined segments under concurrency .