'Build in failing state with BuildEnvironmentError exception'

def test_failing_execution_with_caught_exception(self):

    build_env = LocalEnvironment(version=self.version, project=self.project, build={'id': DUMMY_BUILD_ID})
    with build_env:
        raise BuildEnvironmentError('Foobar')
    self.assertFalse(self.mocks.process.communicate.called)
    self.assertEqual(len(build_env.commands), 0)
    self.assertTrue(build_env.done)
    self.assertTrue(build_env.failed)
    self.assertFalse(self.mocks.api()(DUMMY_BUILD_ID).put.called)
