exp: add dvc exp clean command

This commit is contained in:
Peter Rowlands
2023-03-02 12:35:54 +09:00
committed by Peter Rowlands (변기호)
parent ccbe2de89e
commit 78fb5275e5
6 changed files with 63 additions and 0 deletions
@@ -633,3 +633,9 @@ def test_experiment_run_dry(tmp_dir, scm, dvc, exp_stage):
dvc.experiments.run(exp_stage.addressing, dry=True)
assert len(dvc.experiments.ls()["master"]) == 0
def test_clean(tmp_dir, scm, dvc, mocker):
clean = mocker.spy(dvc.experiments.celery_queue.celery, "clean")
dvc.experiments.clean()
clean.assert_called_once_with()
+13
View File
@@ -8,6 +8,7 @@ import pytest
from dvc.cli import DvcParserError, parse_args
from dvc.commands.experiments.apply import CmdExperimentsApply
from dvc.commands.experiments.branch import CmdExperimentsBranch
from dvc.commands.experiments.clean import CmdExperimentsClean
from dvc.commands.experiments.diff import CmdExperimentsDiff
from dvc.commands.experiments.gc import CmdExperimentsGC
from dvc.commands.experiments.init import CmdExperimentsInit
@@ -926,3 +927,15 @@ def test_experiments_save(dvc, scm, mocker):
m.assert_called_once_with(
cmd.repo, name="exp-name", force=True, include_untracked=[]
)
def test_experiments_clean(dvc, scm, mocker):
cli_args = parse_args(["experiments", "clean"])
assert cli_args.func == CmdExperimentsClean
cmd = cli_args.func(cli_args)
m = mocker.patch("dvc.repo.experiments.clean.clean", return_value={})
assert cmd.run() == 0
m.assert_called_once_with(cmd.repo)