From 92f714e5ca7f4a9e7701a06f7d21b478049f4af7 Mon Sep 17 00:00:00 2001 From: Gavin Li Date: Fri, 7 Jan 2022 18:31:39 -0800 Subject: [PATCH] fs: test_links: create destination directory first `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. --- dvc/fs/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dvc/fs/utils.py b/dvc/fs/utils.py index 301a648d44..9f33884e76 100644 --- a/dvc/fs/utils.py +++ b/dvc/fs/utils.py @@ -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: