Skip to content

Commit

Permalink
dvc/tree/local: fix it for no repo/cache case (iterative#5118)
Browse files Browse the repository at this point in the history
* dvc/tree/local: fix it for no repo/cache case

fixes iterative#5069

* Update dvc/output/base.py

* Update dvc/output/base.py

Co-authored-by: Ruslan Kuprieiev <[email protected]>
  • Loading branch information
dkropachev and efiop authored Dec 25, 2020
1 parent 0bb3f40 commit eb8e03a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 0 additions & 1 deletion dvc/repo/get_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ def get_url(url, out=None):
if not dep.exists:
raise dep.DoesNotExistError(dep)
dep.download(out)
out.save()
10 changes: 10 additions & 0 deletions tests/func/test_get_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ def test_get_file(tmp_dir):
assert (tmp_dir / "foo_imported").read_text() == "foo contents"


def test_get_dir(tmp_dir):
tmp_dir.gen({"foo": {"foo": "foo contents"}})

Repo.get_url("foo", "foo_imported")

assert (tmp_dir / "foo_imported").is_dir()
assert (tmp_dir / "foo_imported" / "foo").is_file()
assert (tmp_dir / "foo_imported" / "foo").read_text() == "foo contents"


@pytest.mark.parametrize("dname", [".", "dir", "dir/subdir"])
def test_get_url_to_dir(tmp_dir, dname):
tmp_dir.gen({"foo": "foo contents", "dir": {"subdir": {}}})
Expand Down

0 comments on commit eb8e03a

Please sign in to comment.