def test_successful_stop(self): """ test calling stop() when slave is running """ # patch stopSlave() to do nothing mock_stopSlave = mock.Mock() self.patch(runner, "stopSlave", mock_stopSlave) runner.stop(self.config) mock_stopSlave.assert_called_once_with(self.config["basedir"], self.config["quiet"], "TERM")
def test_no_slave_running(self): """ test calling stop() when no slave is running """ self.setUpStdoutAssertions() # patch stopSlave() to raise an exception mock_stopSlave = mock.Mock(side_effect=runner.SlaveNotRunning()) self.patch(runner, "stopSlave", mock_stopSlave) runner.stop(self.config) self.assertStdoutEqual("buildslave not running\n")