mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-11 15:28:27 +01:00
exp run: account for repo root when staging git-deps
This commit is contained in:
committed by
Peter Rowlands (변기호)
parent
9837747eef
commit
f13443477d
@@ -64,7 +64,9 @@ def _get_stage_files(stage: "Stage") -> typing.Iterator[str]:
|
||||
if (
|
||||
not dep.use_scm_ignore
|
||||
and dep.is_in_repo
|
||||
and not stage.repo.dvcfs.isdvc(dep.fs_path)
|
||||
and not stage.repo.dvcfs.isdvc(
|
||||
stage.repo.dvcfs.from_os_path(str(dep))
|
||||
)
|
||||
):
|
||||
yield dep.fs_path
|
||||
for out in stage.outs:
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
import os
|
||||
|
||||
from dvc.repo.reproduce import _get_stage_files
|
||||
|
||||
|
||||
def test_number_reproduces(tmp_dir, dvc, mocker):
|
||||
reproduce_stage_mock = mocker.patch(
|
||||
"dvc.repo.reproduce._reproduce_stage", returns=[]
|
||||
@@ -22,3 +27,42 @@ def test_number_reproduces(tmp_dir, dvc, mocker):
|
||||
dvc.reproduce(all_pipelines=True)
|
||||
|
||||
assert reproduce_stage_mock.call_count == 5
|
||||
|
||||
|
||||
def test_get_stage_files(tmp_dir, dvc):
|
||||
tmp_dir.dvc_gen("dvc-dep", "dvc-dep")
|
||||
tmp_dir.gen("other-dep", "other-dep")
|
||||
|
||||
stage = dvc.stage.add(
|
||||
name="stage",
|
||||
cmd="foo",
|
||||
deps=["dvc-dep", "other-dep"],
|
||||
outs=["dvc-out"],
|
||||
outs_no_cache=["other-out"],
|
||||
)
|
||||
result = set(_get_stage_files(stage))
|
||||
assert result == {
|
||||
stage.dvcfile.relpath,
|
||||
str(tmp_dir / "other-dep"),
|
||||
str(tmp_dir / "other-out"),
|
||||
}
|
||||
|
||||
|
||||
def test_get_stage_files_wdir(tmp_dir, dvc):
|
||||
tmp_dir.gen({"dir": {"dvc-dep": "dvc-dep", "other-dep": "other-dep"}})
|
||||
dvc.add(os.path.join("dir", "dvc-dep"))
|
||||
|
||||
stage = dvc.stage.add(
|
||||
name="stage",
|
||||
cmd="foo",
|
||||
wdir="dir",
|
||||
deps=["dvc-dep", "other-dep"],
|
||||
outs=["dvc-out"],
|
||||
outs_no_cache=["other-out"],
|
||||
)
|
||||
result = set(_get_stage_files(stage))
|
||||
assert result == {
|
||||
stage.dvcfile.relpath,
|
||||
str(tmp_dir / "dir" / "other-dep"),
|
||||
str(tmp_dir / "dir" / "other-out"),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user