def WhenNonExistentPythonIsGiven_ReturnAnError_test(self, *args): python = "/non/existing/path/python" with self.UserOption("python_binary_path", python): response = self._app.get("/ready", {"subserver": "python"}, expect_errors=True).json msg = BINARY_NOT_FOUND_MESSAGE.format(python) assert_that(response, self._ErrorMatcher(RuntimeError, msg)) utils.SafePopen.assert_not_called()
def RestartServerWithNonExistingPythonArgument_test(self, *args): python = "/non/existing/python" request = self._BuildRequest(filetype="python", command_arguments=["RestartServer", python]) response = self._app.post_json("/run_completer_command", request, expect_errors=True).json msg = BINARY_NOT_FOUND_MESSAGE.format(python) assert_that(response, self._ErrorMatcher(RuntimeError, msg)) assert_that(utils.SafePopen, was_called_with_python(sys.executable))
def UserDefinedPython_WhenNonExistentPythonIsGiven_ReturnAnError_test( app, *args): response = app.get('/ready', { 'subserver': 'python' }, expect_errors=True).json msg = BINARY_NOT_FOUND_MESSAGE.format('/non/existing/path/python') assert_that(response, ErrorMatcher(RuntimeError, msg)) utils.SafePopen.assert_not_called()
def UserDefinedPython_WhenNonExistentPythonIsGiven_ReturnAnError_test( app, *args ): response = app.get( '/ready', { 'subserver': 'python' }, expect_errors = True ).json msg = BINARY_NOT_FOUND_MESSAGE.format( '/non/existing/path/python' ) assert_that( response, ErrorMatcher( RuntimeError, msg ) ) utils.SafePopen.assert_not_called()
def WhenNonExistentPythonIsGiven_ReturnAnError_test(self, *args): python = '/non/existing/path/python' with self.UserOption('python_binary_path', python): response = self._app.get('/ready', { 'subserver': 'python' }, expect_errors=True).json msg = BINARY_NOT_FOUND_MESSAGE.format(python) assert_that(response, self._ErrorMatcher(RuntimeError, msg)) utils.SafePopen.assert_not_called()
def RestartServerWithNonExistingPythonArgument_test(self, *args): python = '/non/existing/python' request = self._BuildRequest( filetype='python', command_arguments=['RestartServer', python]) response = self._app.post_json('/run_completer_command', request, expect_errors=True).json msg = BINARY_NOT_FOUND_MESSAGE.format(python) assert_that(response, self._ErrorMatcher(RuntimeError, msg)) assert_that(utils.SafePopen, was_called_with_python(sys.executable))
def UserDefinedPython_RestartServerWithNonExistingPythonArgument_test( app, *args ): python = '/non/existing/python' request = BuildRequest( filetype = 'python', command_arguments = [ 'RestartServer', python ] ) response = app.post_json( '/run_completer_command', request, expect_errors = True ).json msg = BINARY_NOT_FOUND_MESSAGE.format( python ) assert_that( response, ErrorMatcher( RuntimeError, msg ) ) assert_that( utils.SafePopen, was_called_with_python( sys.executable ) )