pull: proper path join for partial pulls (#5579)

* pull: proper path join for partial pulls

* use os.path.join in the tests for windows
This commit is contained in:
Batuhan Taskaya
2021-03-09 15:36:44 +02:00
committed by GitHub
parent 7ae2d37116
commit b221c16c89
2 changed files with 11 additions and 1 deletions
+1 -1
View File
@@ -475,7 +475,7 @@ class BaseOutput:
return 0
return ilen(
filter_info.isin_or_eq(self.path_info / relpath)
filter_info.isin_or_eq(self.path_info.joinpath(*relpath))
for relpath, _ in self.hash_info.dir_info.items()
)
+10
View File
@@ -537,3 +537,13 @@ def test_push_pull_fetch_pipeline_stages(tmp_dir, dvc, run_copy, local_remote):
dvc.fetch("copy-foo-bar")
assert len(recurse_list_dir(dvc.odb.local.cache_dir)) == 1
def test_pull_partial(tmp_dir, dvc, local_remote):
tmp_dir.dvc_gen({"foo": {"bar": {"baz": "baz"}, "spam": "spam"}})
dvc.push()
clean(["foo"], dvc)
stats = dvc.pull(os.path.join("foo", "bar"))
assert stats["fetched"] == 1
assert (tmp_dir / "foo").read_text() == {"bar": {"baz": "baz"}}