def __init__(self, dest, **kwargs): self._running = False self._stopping = False try: self._install(dest) except Exception: msg = "Unable to install %r" % dest LOG.error(msg, exc_info=True) raise LauncherError(msg)
def __init__(self, dest, **kwargs): self._running = False self._stopping = False try: self._install(dest) except Exception as e: msg = "Unable to install {} (error: {})".format(dest, e) LOG.error(msg) raise LauncherError(msg).with_traceback(sys.exc_info()[2])
def start(self, **kwargs): """ Start the application. """ if not self._running: try: self._start(**kwargs) except Exception: msg = "Unable to start the application" LOG.error(msg, exc_info=True) raise LauncherError(msg) self._running = True
def start(self, **kwargs): """ Start the application. """ if not self._running: try: self._start(**kwargs) except Exception as e: msg = "Unable to start the application (error: {})".format(e) LOG.error(msg) raise LauncherError(msg).with_traceback(sys.exc_info()[2]) self._running = True
def stop(self): """ Stop the application. """ if self._running: self._stopping = True try: self._stop() except Exception: msg = "Unable to stop the application" LOG.error(msg, exc_info=True) raise LauncherError(msg) self._running = False self._stopping = False
def stop(self): """ Stop the application. """ if self._running: self._stopping = True try: self._stop() except Exception as e: msg = "Unable to stop the application (error: {})".format(e) LOG.error(msg) raise LauncherError(msg).with_traceback(sys.exc_info()[2]) self._running = False self._stopping = False
def test__bisect_with_launcher_exception(self): test_result = self.do__bisect(MyBuildData([1, 2, 3, 4, 5]), ['g', LauncherError("err")]) # check that set_build_range was called self.handler.set_build_range.assert_has_calls([ # first call call(MyBuildData([1, 2, 3, 4, 5])), # we answered good call(MyBuildData([3, 4, 5])), # launcher exception, equivalent to a skip call(MyBuildData([3, 5])), ]) # ensure that we called the handler's methods self.handler.initialize.assert_called_with() self.handler.build_good.assert_called_with(2, MyBuildData([3, 4, 5])) self.handler.build_skip.assert_called_with(1) self.assertTrue(self.handler.build_range.ensure_limits_called) # bisection is finished self.assertEqual(test_result['result'], Bisection.FINISHED)