Exemplo n.º 1
0
def test_catalog_from_config(glottolog_dir, tmpds, mocker, tmpdir, fixtures_dir):
    from cldfcatalog import Config

    # First case: get a "good" value from comfig:
    mocker.patch(
        'cldfcatalog.config.appdirs',
        mocker.Mock(user_config_dir=mocker.Mock(return_value=str(tmpdir))))
    mocker.patch('cldfbench.commands.catconfig.confirm', mocker.Mock(return_value=False))
    cli.main(['catconfig', '--glottolog', str(glottolog_dir)])
    cli.main(['catinfo'])

    # Second case: get an invalid path from config:
    with Config.from_file() as cfg:
        cfg.add_clone('glottolog', fixtures_dir)
    with pytest.raises(SystemExit):
        cli.main(['makecldf', tmpds])
Exemplo n.º 2
0
def _main(cmd, **kw):
    main(['--no-config'] + shlex.split(cmd), **kw)
Exemplo n.º 3
0
def _main(cmd, **kw):
    return cli.main(shlex.split('--no-config ' + cmd), **kw)
Exemplo n.º 4
0
def test_download(tmp_path, mocker):
    mocker.patch('cldfzenodo.commands.download.Record', mocker.Mock())
    main(['zenodo.download', 'x', '--directory', str(tmp_path)])