mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-05 23:09:32 +01:00
Outs desc will be used by viewer right away. Stage desc is for people to start using now, but we won't be using it it viewer until DAG support is added there.
71 lines
1.4 KiB
Python
71 lines
1.4 KiB
Python
from dvc.cli import parse_args
|
|
from dvc.command.imp import CmdImport
|
|
|
|
|
|
def test_import(mocker):
|
|
cli_args = parse_args(
|
|
[
|
|
"import",
|
|
"repo_url",
|
|
"src",
|
|
"--out",
|
|
"out",
|
|
"--file",
|
|
"file",
|
|
"--rev",
|
|
"version",
|
|
"--desc",
|
|
"description",
|
|
]
|
|
)
|
|
assert cli_args.func == CmdImport
|
|
|
|
cmd = cli_args.func(cli_args)
|
|
m = mocker.patch.object(cmd.repo, "imp", autospec=True)
|
|
|
|
assert cmd.run() == 0
|
|
|
|
m.assert_called_once_with(
|
|
"repo_url",
|
|
path="src",
|
|
out="out",
|
|
fname="file",
|
|
rev="version",
|
|
no_exec=False,
|
|
desc="description",
|
|
)
|
|
|
|
|
|
def test_import_no_exec(mocker):
|
|
cli_args = parse_args(
|
|
[
|
|
"import",
|
|
"repo_url",
|
|
"src",
|
|
"--out",
|
|
"out",
|
|
"--file",
|
|
"file",
|
|
"--rev",
|
|
"version",
|
|
"--no-exec",
|
|
"--desc",
|
|
"description",
|
|
]
|
|
)
|
|
|
|
cmd = cli_args.func(cli_args)
|
|
m = mocker.patch.object(cmd.repo, "imp", autospec=True)
|
|
|
|
assert cmd.run() == 0
|
|
|
|
m.assert_called_once_with(
|
|
"repo_url",
|
|
path="src",
|
|
out="out",
|
|
fname="file",
|
|
rev="version",
|
|
no_exec=True,
|
|
desc="description",
|
|
)
|