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
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
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
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
def git_repo(tmp_path): return get_test_repo(tmp_path, remote_url='https://github.com/lexibank/dataset.git')
class Thing(Dataset): id = 'this' dir = pathlib.Path( get_test_repo( str(tmpdir), remote_url='https://github.com/org/repo.git').working_dir)
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))
def git_repo(tmpdir): return get_test_repo(str(tmpdir), remote_url='https://github.com/lexibank/dataset.git')