Add tests for `install`, `doc`, `list`
@@ -59,7 +59,7 @@ def test_cli_check_version():
@pytest.mark.parametrize(
"invalid_version",
- ("5.15", "five-dot-fifteen", "5"),
+ ("5.15", "five-dot-fifteen", "5", "5.5.5.5"),
)
def test_cli_invalid_version(capsys, invalid_version):
"""Checks that invalid version strings are handled properly"""
@@ -70,19 +70,21 @@ def test_cli_invalid_version(capsys, invalid_version):
cli = aqt.installer.Cli()
cli._setup_settings()
+
+ matcher = re.compile(
+ r"^aqtinstall\(aqt\) v.* on Python 3.*\n"
+ r".*Invalid version: '" + invalid_version + r"'! Please use the form '5\.X\.Y'\.\n.*"
+ )
+
+ for cmd in "install", "doc", "list":
with pytest.raises(SystemExit) as pytest_wrapped_e:
cli = aqt.installer.Cli()
- cli.run(["install", invalid_version, "mac", "desktop"])
+ cli.run([cmd, invalid_version, "mac", "desktop"])
assert pytest_wrapped_e.type == SystemExit
assert pytest_wrapped_e.value.code == 1
out, err = capsys.readouterr()
sys.stdout.write(out)
sys.stderr.write(err)
-
- matcher = re.compile(
- r"^aqtinstall\(aqt\) v.* on Python 3.*\n"
- r".*Invalid version: '" + invalid_version + r"'! Please use the form '5\.X\.Y'\.\n.*"
- )
assert matcher.match(err)
