def TestInit():
 global INIT_RAN
 if (stats.STATS is None):
  stats.STATS = stats.StatsCollector()
 flags.FLAGS.config = config_lib.Resource().Filter('install_data/etc/grr-server.yaml')
 flags.FLAGS.secondary_configs = [config_lib.Resource().Filter('test_data/grr_test.yaml@grr-response-test')]
 extra_test_config = config_lib.CONFIG['Test.additional_test_config']
 if os.path.exists(extra_test_config):
  flags.FLAGS.secondary_configs.append(extra_test_config)
 config_lib.CONFIG.AddContext('Test Context', 'Context applied when we run tests.')
 config_lib.SetPlatformArchContext()
 config_lib.ParseConfigCommandLine()
 if (not INIT_RAN):
  log.ServerLoggingStartupInit()
 registry.TestInit()
 INIT_RAN = True

def TestInit ( ) : global INIT_RAN if ( stats . STATS is None ) : stats . STATS = stats . StatsCollector ( ) flags . FLAGS . config = config_lib . Resource ( ) . Filter ( 'install_data/etc/grr-server.yaml' ) flags . FLAGS . secondary_configs = [ config_lib . Resource ( ) . Filter ( 'test_data/grr_test.yaml@grr-response-test' ) ] extra_test_config = config_lib . CONFIG [ 'Test.additional_test_config' ] if os . path . exists ( extra_test_config ) : flags . FLAGS . secondary_configs . append ( extra_test_config ) config_lib . CONFIG . AddContext ( 'Test Context' , 'Context applied when we run tests.' ) config_lib . SetPlatformArchContext ( ) config_lib . ParseConfigCommandLine ( ) if ( not INIT_RAN ) : log . ServerLoggingStartupInit ( ) registry . TestInit ( ) INIT_RAN = True
only used in tests and will rerun all the hooks to create a clean state .