Files
dvc/tests/unit/command/test_live.py
T
Paweł RedzyńskiandRuslan Kuprieiev 862ab8de62 live logs initial (#4902)
* 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]>
2021-01-04 11:29:41 +02:00

43 lines
975 B
Python

from dvc.cli import parse_args
from dvc.command.live import CmdLiveDiff, CmdLiveShow
def test_live_diff(dvc, mocker):
cli_args = parse_args(
[
"live",
"diff",
"--out",
"result.extension",
"target",
"--revs",
"HEAD",
"rev1",
]
)
assert cli_args.func == CmdLiveDiff
cmd = cli_args.func(cli_args)
m = mocker.patch("dvc.repo.live.Live.show", return_value=({}, {}))
assert cmd.run() == 0
m.assert_called_once_with(
target="target", revs=["HEAD", "rev1"],
)
def test_live_show(dvc, mocker):
cli_args = parse_args(
["live", "show", "-o", "result.extension", "datafile"]
)
assert cli_args.func == CmdLiveShow
cmd = cli_args.func(cli_args)
m = mocker.patch("dvc.repo.live.Live.show", return_value=({}, {}))
assert cmd.run() == 0
m.assert_called_once_with(target="datafile", revs=None)