def CompatibleWithCurrentCore_Outdated_NoYcmCoreVersionMethod_test( logger, *args): assert_that(CompatibleWithCurrentCore(), equal_to(7)) assert_that(logger.method_calls, has_length(1)) logger.exception.assert_called_with( 'ycm_core library too old; PLEASE RECOMPILE by running the build.py ' 'script. See the documentation for more details.')
def RunCompatibleWithCurrentCoreImportException(test, logger): with patch('ycmd.server_utils.ImportCore', side_effect=ImportError(test['exception_message'])): assert_that(CompatibleWithCurrentCore(), equal_to(test['exit_status'])) assert_that(logger.method_calls, has_length(1)) logger.exception.assert_called_with(test['logged_message'])
def Main(): args = ParseArguments() SetupLogging(args.log) options = SetupOptions(args.options_file) YcmCoreSanityCheck() extra_conf_store.CallGlobalExtraConfYcmCorePreloadIfExists() code = CompatibleWithCurrentCore() if code: sys.exit(code) # These can't be top-level imports because they transitively import # ycm_core which we want to be imported ONLY after extra conf # preload has executed. from ycmd import handlers handlers.UpdateUserOptions(options) handlers.KeepSubserversAlive(args.check_interval_seconds) SetUpSignalHandler() atexit.register(handlers.ServerCleanup) pipe = OpenStdPipe() handlers.wsgi_server = PipeServer(handlers.app, pipe) handlers.wsgi_server.Run()
def CompatibleWithCurrentCore_Compatible_test(logger): assert_that(CompatibleWithCurrentCore(), equal_to(0)) assert_that(logger.method_calls, empty())