Esempio n. 1
0
def test_load_conf(conf):
    inconf = config.conf.copy()
    expected = inconf.copy()
    with temp_conf(conf) as fn:
        config.load_conf(fn)
        expected.update(conf)
        assert config.conf == expected
        config.reset_conf()
        assert config.conf == inconf
Esempio n. 2
0
def test_load_conf(conf):
    # This test will only work if your config is set to default
    inconf = config.defaults.copy()
    expected = inconf.copy()
    with temp_conf(conf) as fn:
        config.load_conf(fn)
        expected.update(conf)
        assert config.conf == expected
        config.reset_conf()
        assert config.conf == inconf
Esempio n. 3
0
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.reset_conf()
    if original:
        os.environ[key] = original
    else:
        del os.environ[key]
    assert config.cfile() != temp_config_path
Esempio n. 4
0
def conf_reset_save(args):
    from intake.config import reset_conf, save_conf
    reset_conf()
    save_conf()
Esempio n. 5
0
 def _reset(self, args):
     from intake.config import reset_conf, save_conf
     reset_conf()
     save_conf()