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

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

* stage add: introduce --run option

Part of #5846.

* fix ui message

(cherry picked from commit 1989c0fe98)

Co-authored-by: skshetry <[email protected]>
This commit is contained in:
mergify[bot]
2023-05-22 12:48:15 +05:45
committed by GitHub
co-authored by skshetry
parent 60e161004d
commit a9ae450a64
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)