def Wrapper(*args, **kwargs): with IsolatedApp() as app: try: with CurrentWorkingDirectory(directory): test(app, *args, **kwargs) finally: StopCompleterServer(app, 'javascript')
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)))
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
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)
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)
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]')))
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]' ) ) )
def FindExecutable_CurrentDirectory_test(): with TemporaryExecutable() as executable: dirname, exename = os.path.split(executable) with CurrentWorkingDirectory(dirname): eq_(executable, utils.FindExecutable(exename))
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)))