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)
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)
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
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
def test_override_default_value(): def_map = make_default_map({"tag": True}) assert def_map.get("tag")
def test_empty_config(): assert make_default_map({}) == DEFAULT_CONFIG
def test_override_default_value(): def_map = make_default_map({'tag': True}) assert def_map.get('tag')