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.
This commit is contained in:
Gavin Li
2022-01-08 13:56:51 +02:00
committed by Ruslan Kuprieiev
parent 634246f81c
commit 92f714e5ca
+1
View File
@@ -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: