mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-06 23:09:55 +01:00
fix: #7591 1. Add a new command `dvc queue` 2. Add two sub-command `dvc queue remove` and `dvc queue kill` 3. Add a unit test to test them Co-authored-by: Peter Rowlands (변기호) <[email protected]>
64 lines
1.4 KiB
Python
64 lines
1.4 KiB
Python
from dvc.cli import parse_args
|
|
from dvc.commands.queue.kill import CmdQueueKill
|
|
from dvc.commands.queue.remove import CmdQueueRemove
|
|
|
|
|
|
def test_experiments_remove(dvc, scm, mocker):
|
|
cli_args = parse_args(
|
|
[
|
|
"queue",
|
|
"remove",
|
|
"--all",
|
|
]
|
|
)
|
|
assert cli_args.func == CmdQueueRemove
|
|
|
|
cmd = cli_args.func(cli_args)
|
|
m = mocker.patch(
|
|
"dvc.repo.experiments.queue.local.LocalCeleryQueue.clear",
|
|
return_value={},
|
|
)
|
|
|
|
assert cmd.run() == 0
|
|
m.assert_called_once_with()
|
|
|
|
cli_args = parse_args(
|
|
[
|
|
"queue",
|
|
"remove",
|
|
"exp1",
|
|
"exp2",
|
|
]
|
|
)
|
|
assert cli_args.func == CmdQueueRemove
|
|
|
|
cmd = cli_args.func(cli_args)
|
|
m = mocker.patch(
|
|
"dvc.repo.experiments.queue.local.LocalCeleryQueue.remove",
|
|
return_value={},
|
|
)
|
|
|
|
assert cmd.run() == 0
|
|
m.assert_called_once_with(revs=["exp1", "exp2"])
|
|
|
|
|
|
def test_experiments_kill(dvc, scm, mocker):
|
|
cli_args = parse_args(
|
|
[
|
|
"queue",
|
|
"kill",
|
|
"exp1",
|
|
"exp2",
|
|
]
|
|
)
|
|
assert cli_args.func == CmdQueueKill
|
|
|
|
cmd = cli_args.func(cli_args)
|
|
m = mocker.patch(
|
|
"dvc.repo.experiments.queue.local.LocalCeleryQueue.kill",
|
|
return_value={},
|
|
)
|
|
|
|
assert cmd.run() == 0
|
|
m.assert_called_once_with(revs=["exp1", "exp2"])
|