mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
repo: use realpath to in _get_filepath when loading stages
This commit is contained in:
+2
-3
@@ -225,10 +225,9 @@ class StageLoad:
|
||||
path, name = parse_target(target)
|
||||
return self.load_one(path=path, name=name)
|
||||
|
||||
@staticmethod
|
||||
def _get_filepath(path: str = None, name: str = None) -> str:
|
||||
def _get_filepath(self, path: str = None, name: str = None) -> str:
|
||||
if path:
|
||||
return path
|
||||
return self.repo.fs.path.realpath(path)
|
||||
|
||||
path = PIPELINE_FILE
|
||||
logger.debug("Assuming '%s' to be a stage inside '%s'", name, path)
|
||||
|
||||
@@ -265,6 +265,23 @@ def test_collect_repo_ignored_dir_unignored_pattern(tmp_dir, dvc, scm):
|
||||
assert dvc.stage.collect_repo() == [stage]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("with_deps", (False, True))
|
||||
def test_collect_symlink(tmp_dir, dvc, with_deps):
|
||||
tmp_dir.gen({"data": {"foo": "foo contents"}})
|
||||
foo_path = os.path.join("data", "foo")
|
||||
dvc.add(foo_path)
|
||||
|
||||
data_link = tmp_dir / "data_link"
|
||||
data_link.symlink_to("data")
|
||||
stage = list(
|
||||
dvc.stage.collect(
|
||||
target=str(data_link / "foo.dvc"), with_deps=with_deps
|
||||
)
|
||||
)[0]
|
||||
|
||||
assert stage.addressing == f"{foo_path}.dvc"
|
||||
|
||||
|
||||
def test_stage_strings_representation(tmp_dir, dvc, run_copy):
|
||||
tmp_dir.dvc_gen("foo", "foo")
|
||||
stage1 = run_copy("foo", "bar", single_stage=True)
|
||||
|
||||
Reference in New Issue
Block a user