Пример #1
0
    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)
Пример #2
0
    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)
Пример #3
0
def test_merge_dictionary(base, additional, expected):
    assert merge_dict(base, additional) == expected
Пример #4
0
def test_merge_dictionary(base, additional, expected):
    assert merge_dict(base, additional) == expected