mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
exp run: Support --message.
Custom commit message to use when committing the experiment. Part of #8870
This commit is contained in:
@@ -773,3 +773,19 @@ def test_mixed_git_dvc_out(tmp_dir, scm, dvc, exp_stage):
|
||||
assert (tmp_dir / "dir" / "metrics.yaml").exists()
|
||||
git_fs = scm.get_fs(exp)
|
||||
assert not git_fs.exists("dir/metrics.yaml")
|
||||
|
||||
|
||||
@pytest.mark.parametrize("tmp", [True, False])
|
||||
def test_custom_commit_message(tmp_dir, scm, dvc, tmp):
|
||||
stage = dvc.stage.add(
|
||||
cmd="echo foo",
|
||||
name="foo",
|
||||
)
|
||||
scm.add_commit(["dvc.yaml"], message="add dvc.yaml")
|
||||
|
||||
exp = first(
|
||||
dvc.experiments.run(
|
||||
stage.addressing, tmp_dir=tmp, message="custom commit message"
|
||||
)
|
||||
)
|
||||
assert scm.gitpython.repo.commit(exp).message == "custom commit message"
|
||||
|
||||
@@ -69,3 +69,16 @@ def test_copy_paths_queue(tmp_dir, scm, dvc):
|
||||
fs = scm.get_fs(exp)
|
||||
assert not fs.exists("dir")
|
||||
assert not fs.exists("file")
|
||||
|
||||
|
||||
def test_custom_commit_message_queue(tmp_dir, scm, dvc):
|
||||
stage = dvc.stage.add(
|
||||
cmd="echo foo",
|
||||
name="foo",
|
||||
)
|
||||
scm.add_commit(["dvc.yaml"], message="add dvc.yaml")
|
||||
|
||||
dvc.experiments.run(stage.addressing, queue=True, message="custom commit message")
|
||||
|
||||
exp = first(dvc.experiments.run(run_all=True))
|
||||
assert scm.gitpython.repo.commit(exp).message == "custom commit message"
|
||||
|
||||
@@ -116,7 +116,12 @@ def test_hydra_sweep(
|
||||
assert patched.call_count == len(expected)
|
||||
for e in expected:
|
||||
patched.assert_any_call(
|
||||
mocker.ANY, params=e, reset=True, targets=None, copy_paths=None
|
||||
mocker.ANY,
|
||||
params=e,
|
||||
reset=True,
|
||||
targets=None,
|
||||
copy_paths=None,
|
||||
message=None,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -136,6 +136,7 @@ def test_experiments_run(dvc, scm, mocker):
|
||||
"reset": False,
|
||||
"machine": None,
|
||||
"copy_paths": [],
|
||||
"message": None,
|
||||
}
|
||||
default_arguments.update(repro_arguments)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user