Files
dvc/tests/unit/command/test_experiments.py
T
Peter Rowlands (변기호)andRuslan Kuprieiev e2b5ab996f experiments: make dvc exp show more consistent w/viewer (#4489)
* experiments: cleanup show UI

* show git tag/branch names instead of SHAs by default
* make timestamp formatting more like the viewer

* update tests

* place timestamps in their own column

* update command test

* exp: remove unused regex

Co-authored-by: Ruslan Kuprieiev <[email protected]>
2020-08-31 00:02:57 +03:00

57 lines
1.3 KiB
Python

from dvc.cli import parse_args
from dvc.command.experiments import CmdExperimentsDiff, CmdExperimentsShow
def test_experiments_diff(dvc, mocker):
cli_args = parse_args(
[
"experiments",
"diff",
"HEAD~10",
"HEAD~1",
"--all",
"--show-json",
"--show-md",
"--old",
"--precision",
"10",
]
)
assert cli_args.func == CmdExperimentsDiff
cmd = cli_args.func(cli_args)
m = mocker.patch("dvc.repo.experiments.diff.diff", return_value={})
assert cmd.run() == 0
m.assert_called_once_with(
cmd.repo, a_rev="HEAD~10", b_rev="HEAD~1", all=True
)
def test_experiments_show(dvc, mocker):
cli_args = parse_args(
[
"experiments",
"show",
"--all-tags",
"--all-branches",
"--all-commits",
"--sha",
]
)
assert cli_args.func == CmdExperimentsShow
cmd = cli_args.func(cli_args)
m = mocker.patch("dvc.repo.experiments.show.show", return_value={})
assert cmd.run() == 0
m.assert_called_once_with(
cmd.repo,
all_tags=True,
all_branches=True,
all_commits=True,
sha_only=True,
)