mirror of
https://github.com/miurahr/aqtinstall.git
synced 2025-12-17 20:54:38 +03:00
Add tests for install, doc, list
This commit is contained in:
@@ -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,20 +70,22 @@ def test_cli_invalid_version(capsys, invalid_version):
|
||||
|
||||
cli = aqt.installer.Cli()
|
||||
cli._setup_settings()
|
||||
with pytest.raises(SystemExit) as pytest_wrapped_e:
|
||||
cli = aqt.installer.Cli()
|
||||
cli.run(["install", 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)
|
||||
|
||||
for cmd in "install", "doc", "list":
|
||||
with pytest.raises(SystemExit) as pytest_wrapped_e:
|
||||
cli = aqt.installer.Cli()
|
||||
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)
|
||||
assert matcher.match(err)
|
||||
|
||||
|
||||
def test_cli_check_mirror():
|
||||
|
||||
Reference in New Issue
Block a user