Expect Cli.run not to exit on connection errors

This commit is contained in:
David Dalcino
2021-09-01 12:36:29 -07:00
parent 772b74d3a3
commit cfd4234877
2 changed files with 5 additions and 11 deletions

View File

@@ -10,11 +10,8 @@ import aqt
def test_cli_unknown_version(capsys):
wrong_version = "5.16.0"
wrong_url_ending = "mac_x64/desktop/qt5_5160/Updates.xml"
with pytest.raises(SystemExit) as pytest_wrapped_e:
cli = aqt.installer.Cli()
cli.run(["install-qt", "mac", "desktop", wrong_version])
assert pytest_wrapped_e.type == SystemExit
assert pytest_wrapped_e.value.code == 1
cli = aqt.installer.Cli()
assert cli.run(["install-qt", "mac", "desktop", wrong_version]) == 1
out, err = capsys.readouterr()
sys.stdout.write(out)
sys.stderr.write(err)

View File

@@ -497,12 +497,9 @@ def test_install_bad_tools_modules(monkeypatch, capsys, cmd, xml_file, expected_
monkeypatch.setattr("aqt.archives.getUrl", mock_get_url)
monkeypatch.setattr("aqt.installer.getUrl", mock_get_url)
with pytest.raises(SystemExit) as pytest_wrapped_e:
cli = Cli()
cli._setup_settings()
cli.run(cmd.split())
assert pytest_wrapped_e.type == SystemExit
assert pytest_wrapped_e.value.code == 1
cli = Cli()
cli._setup_settings()
assert cli.run(cmd.split()) == 1
out, err = capsys.readouterr()
match = expected_re.match(err)