@pytest.fixture(scope='session', autouse=True)
def static_config_server(config_path, images_dir, db_name):
    logger.log('testing', f'Starting static_config_server for testing session')
    proc = config_server(config_file=config_path, ignore_local=True, auto_save=False)
    logger.log('testing', f'static_config_server started with proc.pid={proc.pid!r}')
    while (get_config('name') is None):
        logger.log('testing', f'Waiting for static_config_server proc.pid={proc.pid!r}, sleeping 1 second.')
        time.sleep(1)
    logger.log('testing', f"Startup config_server name=[{get_config('name')}]")
    unit_id = 'PAN000'
    logger.log('testing', f'Setting testing name and unit_id to {unit_id}')
    set_config('pan_id', unit_id)
    logger.log('testing', f'Setting testing database to {db_name}')
    set_config('db.name', db_name)
    fields_file = 'simulator.yaml'
    logger.log('testing', f'Setting testing scheduler fields_file to {fields_file}')
    set_config('scheduler.fields_file', fields_file)
    logger.log('testing', f'Setting temporary image directory for testing')
    set_config('directories.images', images_dir)
    (yield)
    logger.log('testing', f'Killing static_config_server started with PID={proc.pid}')
    proc.terminate()
@pytest.fixture(scope='session', autouse=True)
def static_config_server(config_path, images_dir, db_name):
    logger.log('testing', f'Starting static_config_server for testing session')
    proc = config_server(config_file=config_path, ignore_local=True, auto_save=False)
    logger.log('testing', f'static_config_server started with proc.pid={proc.pid!r}')
    while (get_config('name') is None):
        logger.log('testing', f'Waiting for static_config_server proc.pid={proc.pid!r}, sleeping 1 second.')
        time.sleep(1)
    logger.log('testing', f"Startup config_server name=[{get_config('name')}]")
    unit_id = 'PAN000'
    logger.log('testing', f'Setting testing name and unit_id to {unit_id}')
    set_config('pan_id', unit_id)
    logger.log('testing', f'Setting testing database to {db_name}')
    set_config('db.name', db_name)
    fields_file = 'simulator.yaml'
    logger.log('testing', f'Setting testing scheduler fields_file to {fields_file}')
    set_config('scheduler.fields_file', fields_file)
    logger.log('testing', f'Setting temporary image directory for testing')
    set_config('directories.images', images_dir)
    (yield)
    logger.log('testing', f'Killing static_config_server started with PID={proc.pid}')
    proc.terminate()