def test_atomic_download_failure(pd, seg):
 pd.create(seg)
 e = Exception('Anything')
 with pytest.raises(Exception) as err:
  with pd.download(seg):
   raise e
 assert (err.value is e)
 assert (not pd.is_running(seg))
 assert (not pd.contains(seg))

def test_atomic_download_failure ( pd , seg ) : pd . create ( seg ) e = Exception ( 'Anything' ) with pytest . raises ( Exception ) as err : with pd . download ( seg ) : raise e assert ( err . value is e ) assert ( not pd . is_running ( seg ) ) assert ( not pd . contains ( seg ) )
ensure a raised exception doesnt move wal into place .