Skip to content

Commit

Permalink
fs: test_links: create destination directory first
Browse files Browse the repository at this point in the history
`dvc.fs.utils.test_links()` fails with a CacheLinkError if the target `to_path` does not already exist, as is the case when "abc.dvc" exists (referring to a directory object) and we try to run "dvc pull abc/def". To avoid this issue, fully create `to_path` before attempting to create a link in it.
  • Loading branch information
gh2o authored and efiop committed Jan 8, 2022
1 parent 634246f commit 92f714e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions dvc/fs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def test_links(
from_fs.makedirs(from_fs.path.parent(from_file))
with from_fs.open(from_file, "wb") as fobj:
fobj.write(b"test")
to_fs.makedirs(to_fs.path.parent(to_file))

ret = []
try:
Expand Down

0 comments on commit 92f714e

Please sign in to comment.