Exemplo n.º 1
0
 def project_overrides_systemwide(self):
     c = Config(
         system_prefix=join(CONFIGS_PATH, "json/"),
         project_location=join(CONFIGS_PATH, "yaml"),
     )
     c.load_project()
     assert c.outer.inner.hooray == "yaml"
Exemplo n.º 2
0
 def loads_no_project_specific_file_if_no_project_location_given(self):
     c = Config()
     assert c._project_path is None
     c.load_project()
     assert list(c._project.keys()) == []
     defaults = ["tasks", "run", "runners", "sudo", "timeouts"]
     assert set(c.keys()) == set(defaults)
Exemplo n.º 3
0
 def project_specific(self):
     "Local-to-project conf files"
     for type_ in TYPES:
         c = Config(project_location=join(CONFIGS_PATH, type_))
         assert "outer" not in c
         c.load_project()
         assert c.outer.inner.hooray == type_
Exemplo n.º 4
0
 def runtime_overrides_project(self):
     c = Config(
         runtime_path=join(CONFIGS_PATH, "json", "raft.json"),
         project_location=join(CONFIGS_PATH, "yaml"),
     )
     c.load_runtime()
     c.load_project()
     assert c.outer.inner.hooray == "json"
Exemplo n.º 5
0
 def project_can_skip_merging(self):
     config = Config(
         project_location=join(CONFIGS_PATH, "yml"), lazy=True
     )
     assert "outer" not in config._project
     assert "outer" not in config
     config.load_project(merge=False)
     # Test that we loaded into the per-level dict, but not the
     # central/merged config.
     assert "outer" in config._project
     assert "outer" not in config
Exemplo n.º 6
0
 def env_vars_override_project(self):
     os.environ["RAFT_OUTER_INNER_HOORAY"] = "env"
     c = Config(project_location=join(CONFIGS_PATH, "yaml"))
     c.load_project()
     c.load_shell_env()
     assert c.outer.inner.hooray == "env"
Exemplo n.º 7
0
 def project_overrides_collection(self):
     c = Config(project_location=join(CONFIGS_PATH, "yaml"))
     c.load_project()
     c.load_collection({"outer": {"inner": {"hooray": "defaults"}}})
     assert c.outer.inner.hooray == "yaml"
Exemplo n.º 8
0
 def project_location_can_be_set_after_init(self):
     c = Config()
     assert "outer" not in c
     c.set_project_location(join(CONFIGS_PATH, "yml"))
     c.load_project()
     assert c.outer.inner.hooray == "yml"