예제 #1
0
    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()
예제 #2
0
    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))
예제 #3
0
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()
예제 #4
0
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()
예제 #5
0
    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()
예제 #6
0
    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))
예제 #7
0
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 ) )