stage add: introduce --run option (#9480)

* stage add: introduce --run option

Part of #5846.

* fix ui message
This commit is contained in:
skshetry
2023-05-22 12:27:20 +05:45
committed by GitHub
parent 3ddd4b87fc
commit 1989c0fe98
3 changed files with 51 additions and 11 deletions
+12
View File
@@ -86,3 +86,15 @@ def test_stage_add(mocker, dvc, command, parsed_command):
cmd=parsed_command,
force=True,
)
def test_stage_add_and_run(mocker, dvc):
cli_args = parse_args(["stage", "add", "--run", "-n", "foo", "-o", "foo", "cmd"])
cmd = cli_args.func(cli_args)
add_mock = mocker.patch.object(cmd.repo.stage, "add")
assert cmd.run() == 0
assert called_once_with_subset(add_mock, name="foo", outs=["foo"], cmd="cmd")
add_mock.return_value.run.assert_called_once()
add_mock.return_value.dump.assert_called_once_with(update_pipeline=False)