def conf_show_info(args): from intake.config import cfile if 'INTAKE_CONF_DIR' in os.environ: print('INTAKE_CONF_DIR: ', os.environ['INTAKE_CONF_DIR']) if 'INTAKE_CONF_FILE' in os.environ: print('INTAKE_CONF_FILE: ', os.environ['INTAKE_CONF_FILE']) ex = "" if os.path.isfile(cfile()) else "(does not exist)" print('Using: ', cfile(), ex)
def tmp_config_path(tmp_path): key = 'INTAKE_CONF_FILE' original = os.getenv(key) temp_config_path = os.path.join(tmp_path, 'test_config.yml') os.environ[key] = temp_config_path assert config.cfile() == temp_config_path yield temp_config_path config.conf.reset() if original: os.environ[key] = original else: del os.environ[key] assert config.cfile() != temp_config_path