Skip to content

Commit

Permalink
fix(pull): normalize dependency path (#10446)
Browse files Browse the repository at this point in the history
Co-authored-by: Saugat Pachhai (सौगात) <suagatchhetri@outlook.com>
  • Loading branch information
georgeyk and skshetry committed Jun 3, 2024
1 parent b69b368 commit 0e38ccc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dvc/dependency/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self, def_repo: dict[str, Any], stage: "Stage", *args, **kwargs):
super().__init__(stage, *args, **kwargs)

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
return None
Expand Down
6 changes: 4 additions & 2 deletions tests/func/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,18 +305,20 @@ def test_cache_type_is_properly_overridden(tmp_dir, scm, dvc, erepo_dir):
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():
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")
dvc.cache.local.clear()

dvc.pull(["dir_imported.dvc"])

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):
Expand Down

0 comments on commit 0e38ccc

Please sign in to comment.