Improve warning messages re: unknown aqt arguments

This improves the warnings about unknown versions, modules, and
architectures of Qt, so that it is more explicit what the message
actually means.

This changes the purpose of `Cli._check_modules_arg` from checking if
modules exist in combinations.json, to returning a list of modules
that do not exist in that file. The function has been renamed as well.
This change was necessary to make the warning message more informative.
This commit is contained in:
Dave Dalcino
2023-02-16 13:06:12 -08:00
parent 6df6720c52
commit 6a0c174e01
3 changed files with 48 additions and 20 deletions

View File

@@ -53,13 +53,20 @@ def test_cli_help(capsys):
assert expected_help(out)
def test_cli_check_module():
@pytest.mark.parametrize(
"qt_version, modules, unexpected_modules",
(
("5.11.3", ["qtcharts", "qtwebengine"], []),
("5.11.3", ["not_exist"], ["not_exist"]),
("5.11.3", ["qtcharts", "qtwebengine", "not_exist"], ["not_exist"]),
("5.11.3", None, []),
("5.15.0", ["Unknown"], ["Unknown"]),
),
)
def test_cli_select_unexpected_modules(qt_version: str, modules: Optional[List[str]], unexpected_modules: List[str]):
cli = Cli()
cli._setup_settings()
assert cli._check_modules_arg("5.11.3", ["qtcharts", "qtwebengine"])
assert not cli._check_modules_arg("5.7", ["not_exist"])
assert cli._check_modules_arg("5.14.0", None)
assert not cli._check_modules_arg("5.15.0", ["Unknown"])
assert cli._select_unexpected_modules(qt_version, modules) == unexpected_modules
def test_cli_check_combination():

View File

@@ -1052,7 +1052,8 @@ def test_install(
(
"install-qt windows desktop 5.16.0 win32_mingw73",
None,
"WARNING : Specified Qt version is unknown: 5.16.0.\n"
'WARNING : Specified Qt version "5.16.0" did not exist when this version of aqtinstall was released. '
"This may not install properly, but we will try our best.\n"
"ERROR : Failed to locate XML data for Qt version '5.16.0'.\n"
"==============================Suggested follow-up:==============================\n"
"* Please use 'aqt list-qt windows desktop' to show versions available.\n",
@@ -1060,7 +1061,8 @@ def test_install(
(
"install-qt windows desktop 5.15.0 bad_arch",
"windows-5150-update.xml",
"WARNING : Specified target combination is not valid or unknown: windows desktop bad_arch\n"
'WARNING : Specified target combination "windows desktop bad_arch" did not exist when this version of '
"aqtinstall was released. This may not install properly, but we will try our best.\n"
"ERROR : The packages ['qt_base'] were not found while parsing XML of package information!\n"
"==============================Suggested follow-up:==============================\n"
"* Please use 'aqt list-qt windows desktop --arch 5.15.0' to show architectures available.\n",
@@ -1068,7 +1070,8 @@ def test_install(
(
"install-qt windows desktop 5.15.0 win32_mingw73 -m nonexistent foo",
"windows-5150-update.xml",
"WARNING : Some of specified modules are unknown.\n"
"WARNING : Specified modules ['foo', 'nonexistent'] did not exist when this version of aqtinstall "
"was released. This may not install properly, but we will try our best.\n"
"ERROR : The packages ['foo', 'nonexistent', 'qt_base'] were not found"
" while parsing XML of package information!\n"
"==============================Suggested follow-up:==============================\n"
@@ -1106,7 +1109,8 @@ def test_install(
(
"install-tool windows desktop tools_vcredist nonexistent",
"windows-desktop-tools_vcredist-update.xml",
"WARNING : Specified target combination is not valid: windows tools_vcredist nonexistent\n"
'WARNING : Specified target combination "windows tools_vcredist nonexistent" did not exist when this version of '
"aqtinstall was released. This may not install properly, but we will try our best.\n"
"ERROR : The package 'nonexistent' was not found while parsing XML of package information!\n"
"==============================Suggested follow-up:==============================\n"
"* Please use 'aqt list-tool windows desktop tools_vcredist' to show tool variants available.\n",
@@ -1114,7 +1118,8 @@ def test_install(
(
"install-tool windows desktop tools_nonexistent nonexistent",
None,
"WARNING : Specified target combination is not valid: windows tools_nonexistent nonexistent\n"
'WARNING : Specified target combination "windows tools_nonexistent nonexistent" did not exist when this '
"version of aqtinstall was released. This may not install properly, but we will try our best.\n"
"ERROR : Failed to locate XML data for the tool 'tools_nonexistent'.\n"
"==============================Suggested follow-up:==============================\n"
"* Please use 'aqt list-tool windows desktop' to show tools available.\n",