def from_yaml(cls, *paths, **kwargs): # Pull out other keyword arguments override = kwargs.pop("override", None) default = os.path.abspath( os.path.join( os.path.dirname(warehouse.__file__), "config.yml", )) paths = [default] + list(paths) config = {} for path in paths: with open(path) as configfile: # Use no cover to work around a coverage bug config = merge_dict( # pragma: no cover config, yaml.safe_load(configfile)) if override: config = merge_dict(config, override) return cls(config=config, **kwargs)
def from_yaml(cls, *paths, **kwargs): # Pull out other keyword arguments override = kwargs.pop("override", None) default = os.path.abspath(os.path.join( os.path.dirname(warehouse.__file__), "config.yml", )) paths = [default] + list(paths) config = {} for path in paths: with open(path) as configfile: # Use no cover to work around a coverage bug config = merge_dict( # pragma: no cover config, yaml.safe_load(configfile) ) if override: config = merge_dict(config, override) return cls(config=config, **kwargs)
def test_merge_dictionary(base, additional, expected): assert merge_dict(base, additional) == expected