fix(pull): normalize dependency path (#10446)

Co-authored-by: Saugat Pachhai (सौगात) <[email protected]>
This commit is contained in:
George Kussumoto
2024-06-03 16:43:43 +05:45
committed by GitHub
co-authored by Saugat Pachhai
parent b69b368ffe
commit 0e38ccc031
2 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ class RepoDependency(Dependency):
super().__init__(stage, *args, **kwargs) super().__init__(stage, *args, **kwargs)
self.fs = self._make_fs() self.fs = self._make_fs()
self.fs_path = as_posix(self.def_path) self.fs_path = as_posix(self.fs.normpath(self.def_path))
def _parse_path(self, fs, fs_path): # noqa: ARG002 def _parse_path(self, fs, fs_path): # noqa: ARG002
return None return None
+4 -2
View File
@@ -305,11 +305,12 @@ def test_cache_type_is_properly_overridden(tmp_dir, scm, dvc, erepo_dir):
assert scm.is_ignored("foo_imported") assert scm.is_ignored("foo_imported")
def test_pull_imported_directory_stage(tmp_dir, dvc, erepo_dir): @pytest.mark.parametrize("dirpath", ["dir", "dir/"])
def test_pull_imported_directory_stage(tmp_dir, dvc, erepo_dir, dirpath):
with erepo_dir.chdir(): with erepo_dir.chdir():
erepo_dir.dvc_gen({"dir": {"foo": "foo content"}}, commit="create dir") erepo_dir.dvc_gen({"dir": {"foo": "foo content"}}, commit="create dir")
dvc.imp(os.fspath(erepo_dir), "dir", "dir_imported") stage = dvc.imp(os.fspath(erepo_dir), dirpath, "dir_imported")
remove("dir_imported") remove("dir_imported")
dvc.cache.local.clear() dvc.cache.local.clear()
@@ -317,6 +318,7 @@ def test_pull_imported_directory_stage(tmp_dir, dvc, erepo_dir):
dvc.pull(["dir_imported.dvc"]) dvc.pull(["dir_imported.dvc"])
assert (tmp_dir / "dir_imported").read_text() == {"foo": "foo content"} assert (tmp_dir / "dir_imported").read_text() == {"foo": "foo content"}
assert stage.deps[0].fs_path == "dir"
def test_pull_wildcard_imported_directory_stage(tmp_dir, dvc, erepo_dir): def test_pull_wildcard_imported_directory_stage(tmp_dir, dvc, erepo_dir):