예제 #1
0
 def Wrapper(*args, **kwargs):
     with IsolatedApp() as app:
         try:
             with CurrentWorkingDirectory(directory):
                 test(app, *args, **kwargs)
         finally:
             StopCompleterServer(app, 'javascript')
예제 #2
0
def FindExecutable_RelativePath_test():
    with TemporaryExecutable() as executable:
        dirname, exename = os.path.split(executable)
        relative_executable = os.path.join('.', exename)
        with CurrentWorkingDirectory(dirname):
            assert_that(relative_executable,
                        equal_to(utils.FindExecutable(relative_executable)))
예제 #3
0
 def Wrapper(*args, **kwargs):
     old_server_state = handlers._server_state
     app = SetUpApp()
     try:
         with CurrentWorkingDirectory(directory):
             test(app, *args, **kwargs)
     finally:
         StopCompleterServer(app, 'javascript')
         handlers._server_state = old_server_state
예제 #4
0
def WorkingDir_UseServerWorkingDirectory_Unicode_test(app):
    test_dir = os.path.join(TEST_DIR, 'testdata', 'filename_completer', '∂†∫')
    with CurrentWorkingDirectory(test_dir) as old_current_dir:
        ok_(old_current_dir != test_dir,
            ('Please run this test from a different '
             'directory'))

        completer = FilenameCompleter(user_options_store.GetAll())

        # We don't supply working_dir in the request, so the current working
        # directory is used.
        data = sorted(_CompletionResultsForLine(completer, 'ls ./'))
        eq_([('†es†.txt', '[File]')], data)
예제 #5
0
def WorkingDir_UseServerWorkingDirectory_test(app):
    test_dir = os.path.join(DATA_DIR, 'include')
    with CurrentWorkingDirectory(test_dir) as old_current_dir:
        ok_(old_current_dir != test_dir,
            ('Please run this test from a different '
             'directory'))

        completer = FilenameCompleter(user_options_store.GetAll())

        # We don't supply working_dir in the request, so the current working
        # directory is used.
        data = sorted(_CompletionResultsForLine(completer, 'ls ./'))
        eq_([('Qt', '[Dir]'), ('QtGui', '[Dir]')], data)
예제 #6
0
    def test_WorkingDir_UseServerWorkingDirectory(self, app):
        test_dir = os.path.join(DATA_DIR, 'dir with spaces (x64)')
        with CurrentWorkingDirectory(test_dir) as old_current_dir:
            assert_that(old_current_dir != test_dir,
                        'Please run this test from a different directory')

            completion_data = BuildRequest(contents='ls ./',
                                           filepath=PATH_TO_TEST_FILE,
                                           column_num=6)
            results = app.post_json('/completions',
                                    completion_data).json['completions']
            assert_that(
                results,
                contains_inanyorder(CompletionEntryMatcher('Qt', '[Dir]'),
                                    CompletionEntryMatcher('QtGui', '[Dir]')))
예제 #7
0
def WorkingDir_UseServerWorkingDirectory_Unicode_test( app ):
  test_dir = os.path.join( TEST_DIR, 'testdata', 'filename_completer', '∂†∫' )
  with CurrentWorkingDirectory( test_dir ) as old_current_dir:
    ok_( old_current_dir != test_dir, ( 'Please run this test from a different '
                                        'directory' ) )

    # We don't supply working_dir in the request, so the current working
    # directory is used.
    completion_data = BuildRequest( contents = 'ls ./',
                                    filepath = PATH_TO_TEST_FILE,
                                    column_num = 6 )
    results = app.post_json( '/completions',
                             completion_data ).json[ 'completions' ]
    assert_that( results, contains_inanyorder(
      CompletionEntryMatcher( '†es†.txt', '[File]' )
    ) )
예제 #8
0
파일: utils_test.py 프로젝트: rust20/ycmd
def FindExecutable_CurrentDirectory_test():
    with TemporaryExecutable() as executable:
        dirname, exename = os.path.split(executable)
        with CurrentWorkingDirectory(dirname):
            eq_(executable, utils.FindExecutable(exename))
예제 #9
0
 def test_FindExecutable_CurrentDirectory(self):
     with TemporaryExecutable() as executable:
         dirname, exename = os.path.split(executable)
         with CurrentWorkingDirectory(dirname):
             assert_that(executable,
                         equal_to(utils.FindExecutable(exename)))