'When called with the result of ``sequentially``, ``run_state_changes``
stops after the first change that fails and does not run changes after
that.'

def test_failure_stops_later_change(self):

    not_done = Deferred()
    subchanges = [ControllableAction(result=not_done), ControllableAction(result=succeed(None))]
    change = sequentially(changes=subchanges)
    result = run_state_change(change, DEPLOYER, InMemoryStatePersister())
    called = [subchanges[1].called]
    exception = RuntimeError()
    not_done.errback(exception)
    called.extend([subchanges[1].called, self.failureResultOf(result).value])
    self.assertEqual(called, [False, False, exception])
