コード例 #1
0
ファイル: test_config.py プロジェクト: inirudebwoy/bamp
def test_override_all_values():
    config = {
        "vcs": "other",
        "commit": True,
        "message": "Larch",
        "tag_name": "Spam",
        "tag": True,
        "files": "yes",
        "allow_dirty": True,
    }
    def_map = make_default_map(config)
    for k in def_map:
        assert def_map.get(k) == config.get(k)
コード例 #2
0
def test_override_all_values():
    config = {
        'vcs': 'other',
        'commit': True,
        'message': 'Larch',
        'tag_name': 'Spam',
        'tag': True,
        'files': 'yes',
        'allow_dirty': True
    }
    def_map = make_default_map(config)
    for k in def_map:
        assert def_map.get(k) == config.get(k)
コード例 #3
0
ファイル: callbacks.py プロジェクト: inirudebwoy/bamp
def read_config(ctx, param, value):
    """Load config file passed as an argument

    If no file path is passed default value is taken.

    """
    config_path = value or find_config()
    config = {}
    if config_path:

        try:
            config = prepare_config(config_path)
        except ErrorConfigParsing:
            logger.exception('Could not parse the config file.')
            sys.exit(1)

    ctx.default_map = make_default_map(config)
    return value
コード例 #4
0
def read_config(ctx, param, value):
    """Load config file passed as an argument

    If no file path is passed default value is taken.

    """
    config_path = value or find_config()
    config = {}
    if config_path:

        try:
            config = prepare_config(config_path)
        except ErrorConfigParsing:
            logger.exception("Could not parse the config file.")
            sys.exit(1)

    ctx.default_map = make_default_map(config)
    return value
コード例 #5
0
ファイル: test_config.py プロジェクト: inirudebwoy/bamp
def test_override_default_value():
    def_map = make_default_map({"tag": True})
    assert def_map.get("tag")
コード例 #6
0
ファイル: test_config.py プロジェクト: inirudebwoy/bamp
def test_empty_config():
    assert make_default_map({}) == DEFAULT_CONFIG
コード例 #7
0
def test_override_default_value():
    def_map = make_default_map({'tag': True})
    assert def_map.get('tag')