cli: Update code for clap v4

This commit is contained in:
2022-10-06 11:52:59 +02:00
parent 918b63047b
commit 5880066531
4 changed files with 29 additions and 37 deletions

View File

@@ -28,7 +28,7 @@ def get_temporary_directory(dir=None):
def grm(args, cwd=None, is_invalid=False):
cmd = subprocess.run([binary] + args, cwd=cwd, capture_output=True, text=True)
if not is_invalid:
assert "USAGE" not in cmd.stderr
assert "usage" not in cmd.stderr.lower()
print(f"grmcmd: {args}")
print(f"stdout:\n{cmd.stdout}")
print(f"stderr:\n{cmd.stderr}")

View File

@@ -5,9 +5,9 @@ from helpers import *
def test_invalid_command():
cmd = grm(["whatever"], is_invalid=True)
assert "USAGE" in cmd.stderr
assert "usage" in cmd.stderr.lower()
def test_help():
cmd = grm(["--help"])
assert "USAGE" in cmd.stdout
assert "usage" in cmd.stdout.lower()