Ejemplo n.º 1
0
def _config_callback(ctx, param, value):
    try:
        data = parse_config(value)
        config = process_config(data)
    except ConfigError as exc:
        error_echo('Could not load config file')
        error_echo(str(exc))
        ctx.exit(1)
    else:
        config['verbosity'] = ctx.params['verbose']
        config['debug'] = ctx.params['debug']
        config['dry_run'] = ctx.params['dry_run']
        return config
Ejemplo n.º 2
0
def _config_callback(ctx, param, value):
    try:
        data = parse_config(value)
        config = process_config(data)
    except ConfigError as exc:
        error_echo('Could not load config file')
        error_echo(str(exc))
        ctx.exit(1)
    else:
        config['verbosity'] = ctx.params['verbose']
        config['debug'] = ctx.params['debug']
        config['dry_run'] = ctx.params['dry_run']
        return config
Ejemplo n.º 3
0
def test_parse_config_invalid():
    io = StringIO('non: [sense')
    with pytest.raises(config.ConfigError):
        config.parse_config(io)
Ejemplo n.º 4
0
def test_parse_config():
    io = StringIO('foo: bar')
    assert config.parse_config(io) == {'foo': 'bar'}
Ejemplo n.º 5
0
def test_parse_config_invalid():
    io = StringIO('non: [sense')
    with pytest.raises(config.ConfigError):
        config.parse_config(io)
Ejemplo n.º 6
0
def test_parse_config():
    io = StringIO('foo: bar')
    assert config.parse_config(io) == {'foo': 'bar'}