Watch
1
0
Fork
You've already forked git-lad
0
forked from datalad/git-lad
git-lad/git_lad/tests/test_get.py

25 lines
658 B
Python

import pytest
def test_get_noworktree(gitlad, monkeypatch, tmp_path):
monkeypatch.chdir(tmp_path)
with pytest.raises(RuntimeError, match='Not a Git repository'):
gitlad.run(['get'])
def test_get_worktree_subdir(
cfgman, # noqa: ARG001
gitlad,
monkeypatch,
test_datasets,
tmp_path,
):
gitlad.run(
['clone', f'{test_datasets.url}/ds2.git', str(tmp_path)],
)
monkeypatch.chdir(tmp_path / 'subdir1')
# use path relative to CWD, not to worktree path
gitlad.run(['get', 'annexfile2.dat'])
assert (
(tmp_path / 'subdir1' / 'annexfile2.dat').read_text().startswith('annexfile2')
)