mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
exp run: fix failure when dependencies are from inside submodules (#10831)
This commit is contained in:
@@ -793,3 +793,18 @@ def test_custom_commit_message(tmp_dir, scm, dvc, tmp):
|
||||
)
|
||||
)
|
||||
assert scm.resolve_commit(exp).message == "custom commit message"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("dep", ["submodule", "submodule/file"])
|
||||
def test_experiments_run_with_submodule_dependencies(dvc, scm, make_tmp_dir, dep):
|
||||
external_repo = make_tmp_dir("external_repo", scm=True)
|
||||
external_repo.scm_gen("file", "content", commit="add file")
|
||||
|
||||
submodules = scm.pygit2.repo.submodules
|
||||
submodules.add(os.fspath(external_repo), "submodule")
|
||||
submodules.update(init=True)
|
||||
scm.add_commit([".gitmodules"], message="add submodule")
|
||||
|
||||
dvc.stage.add(cmd="echo foo", deps=[dep], name="foo")
|
||||
|
||||
assert dvc.experiments.run()
|
||||
|
||||
@@ -39,7 +39,7 @@ def test_scm_track_changed_files(scm_context):
|
||||
|
||||
scm_context.track_file("foo")
|
||||
scm_context.track_changed_files()
|
||||
scm_context.scm.add.assert_called_once_with({"foo"})
|
||||
scm_context.scm.add.assert_called_once_with(["foo"])
|
||||
|
||||
|
||||
def test_ignore(scm_context):
|
||||
@@ -73,7 +73,7 @@ def test_scm_context_autostage_changed_files(scm_context):
|
||||
|
||||
assert not scm_context.files_to_track
|
||||
assert not scm_context.ignored_paths
|
||||
scm_context.scm.add.assert_called_once_with({"foo"})
|
||||
scm_context.scm.add.assert_called_once_with(["foo"])
|
||||
|
||||
|
||||
def test_scm_context_clears_ignores_on_error(scm_context):
|
||||
@@ -141,4 +141,4 @@ def test_scm_context_decorator(scm_context, mocker):
|
||||
method = mocker.MagicMock(wraps=test_method)
|
||||
decorator(method, autostage=True)(repo, "arg", kw=1)
|
||||
method.assert_called_once_with(repo, "arg", kw=1)
|
||||
scm_context.scm.add.assert_called_once_with({"foo"})
|
||||
scm_context.scm.add.assert_called_once_with(["foo"])
|
||||
|
||||
Reference in New Issue
Block a user