update: --recursive flag (#3760)

* update: --recursive flag

* refactor: applied isort changes to dvc/repo/update.py

* update: removed default values, check for str

* update: fixed code climate cognitive complexity issues
This commit is contained in:
nik123
2020-05-08 23:23:48 +03:00
committed by GitHub
parent 2a16b021ad
commit c922da4f3f
5 changed files with 104 additions and 31 deletions
+7 -10
View File
@@ -1,20 +1,17 @@
import pytest
from dvc.cli import parse_args
from dvc.command.update import CmdUpdate
@pytest.mark.parametrize(
"command,rev", [(["update"], None), (["update", "--rev", "REV"], "REV")]
)
def test_update(dvc, mocker, command, rev):
targets = ["target1", "target2", "target3"]
cli_args = parse_args(command + targets)
def test_update(dvc, mocker):
cli_args = parse_args(
["update", "target1", "target2", "--rev", "REV", "--recursive"]
)
assert cli_args.func == CmdUpdate
cmd = cli_args.func(cli_args)
m = mocker.patch("dvc.repo.Repo.update")
assert cmd.run() == 0
calls = [mocker.call(target, rev) for target in targets]
m.assert_has_calls(calls)
m.assert_called_once_with(
targets=["target1", "target2"], rev="REV", recursive=True,
)