예제 #1
0
 def merging_can_be_deferred(self):
     c = Config()
     assert "foo" not in c._collection
     assert "foo" not in c
     c.load_collection({"foo": "bar"}, merge=False)
     assert "foo" in c._collection
     assert "foo" not in c
예제 #2
0
 def performed_explicitly_and_directly(self):
     # TODO: do we want to update the other levels to allow 'direct'
     # loading like this, now that they all have explicit methods?
     c = Config()
     assert "foo" not in c
     c.load_collection({"foo": "bar"})
     assert c.foo == "bar"
예제 #3
0
 def runtime_overrides_collection(self):
     c = Config(runtime_path=join(CONFIGS_PATH, "json", "raft.json"))
     c.load_collection({"outer": {"inner": {"hooray": "defaults"}}})
     c.load_runtime()
     assert c.outer.inner.hooray == "json"
예제 #4
0
 def env_vars_override_collection(self):
     os.environ["RAFT_OUTER_INNER_HOORAY"] = "env"
     c = Config()
     c.load_collection({"outer": {"inner": {"hooray": "defaults"}}})
     c.load_shell_env()
     assert c.outer.inner.hooray == "env"
예제 #5
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"
예제 #6
0
 def user_overrides_collection(self):
     c = Config(user_prefix=join(CONFIGS_PATH, "json/"))
     c.load_collection({"outer": {"inner": {"hooray": "defaults"}}})
     assert c.outer.inner.hooray == "json"
예제 #7
0
 def systemwide_overrides_collection(self):
     c = Config(system_prefix=join(CONFIGS_PATH, "yaml/"))
     c.load_collection({"outer": {"inner": {"hooray": "defaults"}}})
     assert c.outer.inner.hooray == "yaml"
예제 #8
0
 def collection_overrides_defaults(self):
     c = Config(defaults={"nested": {"setting": "default"}})
     c.load_collection({"nested": {"setting": "collection"}})
     assert c.nested.setting == "collection"