mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-06 07:18:28 +01:00
* plots: allow dir plots * first scenario * separate dvclive tests * rename index to step * another test * refactor * its ok to have step in data * sort plots * introduce --logs * add logs to run commands * variable name refactoring * fix logs option * fixup * cmd: run: fix unit tests * plots: modify: fix tests * improve dir handling * fixup * dvclive: logs summary * api: introduce logs summarization method * handle no repo case * fix granular dir plots * api: dvclive: simplify * dvclive: roll back logs flag * cmd: introduce logs * api: adjust to logs * test: dvclive fix * rename logs to dvclive * live: command: add uninitialized * outs: dvclive type * dvclive: support providing config via evn variables * dvclive: treat as metrics * dvclive integration: add support for summary on/off * dvc integration: add temporary test for configuration export * remove requirements * cmd: introduce logs * rename logs to dvclive * cmd: introduce logs * remove logs leftowvers * dvclive: env: adjust to chekpoints env variables * command: live: remove unnecessary help * fix linter suggestions * type hinting * review refactor * replace dvclive with live * stage: loading: move live loading to separate method * stage: serialize: allow only single live output * live: add show/diff * stage: serialize: roll back single live enforcing * fixup * rebase fixups * output: live: force single instance * live: command: add unit tests * Update dvc/output/base.py Co-authored-by: Ruslan Kuprieiev <[email protected]> * Update dvc/stage/__init__.py Co-authored-by: Ruslan Kuprieiev <[email protected]> * Update dvc/stage/serialize.py Co-authored-by: Ruslan Kuprieiev <[email protected]> * review v2 * live: fix summary tracking by experiments * naming fixups * api: live: add tests * tests: api: separate live tests Co-authored-by: Ruslan Kuprieiev <[email protected]>
155 lines
3.8 KiB
Python
155 lines
3.8 KiB
Python
from dvc.cli import parse_args
|
|
from dvc.command.run import CmdRun
|
|
|
|
|
|
def test_run(mocker, dvc):
|
|
cli_args = parse_args(
|
|
[
|
|
"run",
|
|
"--name",
|
|
"nam",
|
|
"--deps",
|
|
"deps",
|
|
"--outs",
|
|
"outs",
|
|
"--outs-no-cache",
|
|
"outs-no-cache",
|
|
"--metrics",
|
|
"metrics",
|
|
"--metrics-no-cache",
|
|
"metrics-no-cache",
|
|
"--plots",
|
|
"plots",
|
|
"--plots-no-cache",
|
|
"plots-no-cache",
|
|
"--live",
|
|
"live",
|
|
"--live-no-summary",
|
|
"--file",
|
|
"file",
|
|
"--wdir",
|
|
"wdir",
|
|
"--no-exec",
|
|
"--force",
|
|
"--no-run-cache",
|
|
"--no-commit",
|
|
"--outs-persist",
|
|
"outs-persist",
|
|
"--outs-persist-no-cache",
|
|
"outs-persist-no-cache",
|
|
"--checkpoints",
|
|
"checkpoints",
|
|
"--always-changed",
|
|
"--params",
|
|
"file:param1,param2",
|
|
"--params",
|
|
"param3",
|
|
"--external",
|
|
"--desc",
|
|
"description",
|
|
"command",
|
|
]
|
|
)
|
|
assert cli_args.func == CmdRun
|
|
|
|
cmd = cli_args.func(cli_args)
|
|
m = mocker.patch.object(cmd.repo, "run", autospec=True)
|
|
|
|
assert cmd.run() == 0
|
|
|
|
m.assert_called_once_with(
|
|
deps=["deps"],
|
|
outs=["outs"],
|
|
outs_no_cache=["outs-no-cache"],
|
|
metrics=["metrics"],
|
|
metrics_no_cache=["metrics-no-cache"],
|
|
plots=["plots"],
|
|
plots_no_cache=["plots-no-cache"],
|
|
outs_persist=["outs-persist"],
|
|
outs_persist_no_cache=["outs-persist-no-cache"],
|
|
checkpoints=["checkpoints"],
|
|
params=["file:param1,param2", "param3"],
|
|
live="live",
|
|
live_summary=False,
|
|
fname="file",
|
|
wdir="wdir",
|
|
no_exec=True,
|
|
force=True,
|
|
run_cache=False,
|
|
no_commit=True,
|
|
always_changed=True,
|
|
cmd="command",
|
|
name="nam",
|
|
single_stage=False,
|
|
external=True,
|
|
desc="description",
|
|
)
|
|
|
|
|
|
def test_run_args_from_cli(mocker, dvc):
|
|
args = parse_args(["run", "echo", "foo"])
|
|
cmd = args.func(args)
|
|
m = mocker.patch.object(cmd.repo, "run", autospec=True)
|
|
assert cmd.run() == 0
|
|
m.assert_called_once_with(
|
|
deps=[],
|
|
outs=[],
|
|
outs_no_cache=[],
|
|
metrics=[],
|
|
metrics_no_cache=[],
|
|
plots=[],
|
|
plots_no_cache=[],
|
|
live=None,
|
|
live_summary=True,
|
|
outs_persist=[],
|
|
outs_persist_no_cache=[],
|
|
checkpoints=[],
|
|
params=[],
|
|
fname=None,
|
|
wdir=None,
|
|
no_exec=False,
|
|
force=False,
|
|
run_cache=True,
|
|
no_commit=False,
|
|
always_changed=False,
|
|
cmd="echo foo",
|
|
name=None,
|
|
single_stage=False,
|
|
external=False,
|
|
desc=None,
|
|
)
|
|
|
|
|
|
def test_run_args_with_spaces(mocker, dvc):
|
|
args = parse_args(["run", "echo", "foo bar"])
|
|
cmd = args.func(args)
|
|
m = mocker.patch.object(cmd.repo, "run", autospec=True)
|
|
assert cmd.run() == 0
|
|
m.assert_called_once_with(
|
|
deps=[],
|
|
outs=[],
|
|
outs_no_cache=[],
|
|
metrics=[],
|
|
metrics_no_cache=[],
|
|
plots=[],
|
|
plots_no_cache=[],
|
|
live=None,
|
|
live_summary=True,
|
|
outs_persist=[],
|
|
outs_persist_no_cache=[],
|
|
checkpoints=[],
|
|
params=[],
|
|
fname=None,
|
|
wdir=None,
|
|
no_exec=False,
|
|
force=False,
|
|
run_cache=True,
|
|
no_commit=False,
|
|
always_changed=False,
|
|
cmd='echo "foo bar"',
|
|
name=None,
|
|
single_stage=False,
|
|
external=False,
|
|
desc=None,
|
|
)
|