Esempio n. 1
0
def ds(ds_cls, fixtures_dir):
    raw = ds_cls.dir / 'raw'
    raw.mkdir()
    for p in fixtures_dir.glob('test.*'):
        shutil.copy(str(p), str(raw / p.name))
    get_test_repo(raw, remote_url='http://example.org/raw')
    raw.joinpath('non-repo').mkdir()
    shutil.copy(str(fixtures_dir / 'metadata.json'),
                str(ds_cls.dir.joinpath('metadata.json')))
    res = ds_cls()
    return res
Esempio n. 2
0
def glottolog_dir(tmp_path):
    repo = get_test_repo(str(tmp_path), tags=['v1', 'v2'])
    d = pathlib.Path(repo.working_dir)
    for dd in ['languoids', 'references']:
        shutil.copytree(
            pathlib.Path(__file__).parent / 'glottolog' / dd, d / dd)
    return d
Esempio n. 3
0
def concepticon_dir(tmp_path):
    repo = get_test_repo(tmp_path)
    d = pathlib.Path(repo.working_dir)
    d.joinpath('concepticondata').mkdir()
    d.joinpath('concepticondata',
               'concepticon.tsv').write_text('', encoding='utf8')
    return d
Esempio n. 4
0
def tmprepo(tmpdir):
    """
    Turns `tmpdir` into a git repository.
    """
    from cldfcatalog.repository import get_test_repo

    repo = get_test_repo(
        str(tmpdir), remote_url='https://github.com/org/repo.git', tags=['v1.0'], branches=['other'])
    return repo
Esempio n. 5
0
def git_repo(tmp_path):
    return get_test_repo(tmp_path,
                         remote_url='https://github.com/lexibank/dataset.git')
Esempio n. 6
0
 class Thing(Dataset):
     id = 'this'
     dir = pathlib.Path(
         get_test_repo(
             str(tmpdir),
             remote_url='https://github.com/org/repo.git').working_dir)
Esempio n. 7
0
 def clone(self, url, target):
     get_test_repo(str(tmpdir), remote_url=url)
     shutil.copytree(str(tmpdir.join('repo')), str(pathlib.Path(self.d) / target))
Esempio n. 8
0
def git_repo(tmpdir):
    return get_test_repo(str(tmpdir), remote_url='https://github.com/lexibank/dataset.git')