mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-24 23:09:33 +01:00
machine:remove help text for irrelevant commands (#6940)
fix: #6940 `--global/system/project/local` help message are in some irrelevant command `status`, `ssh`, `create`, `destroy`. These commands are more related to running instances rather than `machine config`, level options didn't work for them. 1. Remove `--global/system/project/local` options in `status`, `ssh`, `create`, `destroy`. 2. Add a test for it. 3. Correct a typo error.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import configobj
|
||||
import pytest
|
||||
from mock import call
|
||||
|
||||
from dvc.cli import parse_args
|
||||
@@ -139,3 +140,29 @@ def test_rename(tmp_dir, scm, dvc):
|
||||
assert cmd.run() == 0
|
||||
config = configobj.ConfigObj(str(tmp_dir / ".dvc" / "config"))
|
||||
assert config['machine "bar"']["cloud"] == "aws"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"cmd,use_config",
|
||||
[
|
||||
("add", True),
|
||||
("default", True),
|
||||
("remove", True),
|
||||
("list", True),
|
||||
("modify", True),
|
||||
("create", False),
|
||||
("destroy", False),
|
||||
("rename", True),
|
||||
("status", False),
|
||||
("ssh", False),
|
||||
],
|
||||
)
|
||||
def test_help_message(tmp_dir, scm, dvc, cmd, use_config, capsys):
|
||||
|
||||
try:
|
||||
parse_args(["machine", cmd, "--help"])
|
||||
except SystemExit:
|
||||
pass
|
||||
cap = capsys.readouterr()
|
||||
print(cap.out)
|
||||
assert ("--global" in cap.out) is use_config
|
||||
|
||||
Reference in New Issue
Block a user