Skip to content

Commit 11470f9

Browse files
committed
Fix tests
1 parent cacabe8 commit 11470f9

File tree

3 files changed

+27
-22
lines changed

3 files changed

+27
-22
lines changed

aqt/installer.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -699,12 +699,12 @@ def _set_install_qt_parser(self, install_qt_parser):
699699
def _set_install_tool_parser(self, install_tool_parser):
700700
install_tool_parser.set_defaults(func=self.run_install_tool)
701701
install_tool_parser.add_argument(
702-
"host", choices=["linux", "linux_arm64", "mac", "windows", "windows_arm64"], help="host os name"
702+
"host", choices=["linux", "linux_arm64", "mac", "windows", "windows_arm64", "all_os"], help="host os name"
703703
)
704704
install_tool_parser.add_argument(
705705
"target",
706706
default=None,
707-
choices=["desktop", "winrt", "android", "ios"],
707+
choices=["desktop", "winrt", "android", "ios", "wasm", "qt"],
708708
help="Target SDK.",
709709
)
710710
install_tool_parser.add_argument("tool_name", help="Name of tool such as tools_ifw, tools_mingw")
@@ -752,7 +752,7 @@ def make_parser_sde(cmd: str, desc: str, action, is_add_kde: bool, is_add_module
752752
def make_parser_list_sde(cmd: str, desc: str, cmd_type: str):
753753
parser = subparsers.add_parser(cmd, description=desc)
754754
parser.add_argument(
755-
"host", choices=["linux", "linux_arm64", "mac", "windows", "windows_arm64"], help="host os name"
755+
"host", choices=["linux", "linux_arm64", "mac", "windows", "windows_arm64", "all_os"], help="host os name"
756756
)
757757
parser.add_argument(
758758
"qt_version_spec",
@@ -803,7 +803,7 @@ def _make_list_qt_parser(self, subparsers: argparse._SubParsersAction):
803803
"target",
804804
nargs="?",
805805
default=None,
806-
choices=["desktop", "winrt", "android", "ios", "wasm"],
806+
choices=["desktop", "winrt", "android", "ios", "wasm", "qt"],
807807
help="Target SDK. When omitted, this prints all the targets available for a host OS.",
808808
)
809809
list_parser.add_argument(
@@ -883,13 +883,13 @@ def _make_list_tool_parser(self, subparsers: argparse._SubParsersAction):
883883
"$ aqt list-tool mac desktop ifw --long # print tool variant names with metadata for QtIFW\n",
884884
)
885885
list_parser.add_argument(
886-
"host", choices=["linux", "linux_arm64", "mac", "windows", "windows_arm64"], help="host os name"
886+
"host", choices=["linux", "linux_arm64", "mac", "windows", "windows_arm64", "all_os"], help="host os name"
887887
)
888888
list_parser.add_argument(
889889
"target",
890890
nargs="?",
891891
default=None,
892-
choices=["desktop", "winrt", "android", "ios"],
892+
choices=["desktop", "winrt", "android", "ios", "wasm", "qt"],
893893
help="Target SDK. When omitted, this prints all the targets available for a host OS.",
894894
)
895895
list_parser.add_argument(

aqt/metadata.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ class ArchiveId:
214214
"wasm",
215215
"src_doc_examples",
216216
*EXTENSIONS_REQUIRED_ANDROID_QT6,
217-
"wasm_singlethread",
218-
"wasm_multithread",
217+
# "wasm_singlethread",
218+
# "wasm_multithread",
219219
}
220220

221221
def __init__(self, category: str, host: str, target: str):
@@ -289,14 +289,13 @@ def to_folder(self, version: Version, qt_version_no_dots: str, extension: Option
289289
if extension:
290290
return f"qt{version.major}_{qt_version_no_dots}_{extension}"
291291
return f"qt{version.major}_{qt_version_no_dots}"
292-
else:
293-
# Pre-6.8 structure for non-WASM or pre-6.5 structure
294-
return "{category}{major}_{ver}{ext}".format(
295-
category=self.category,
296-
major=qt_version_no_dots[0],
297-
ver=qt_version_no_dots,
298-
ext="_" + extension if extension else "",
299-
)
292+
# Pre-6.8 structure for non-WASM or pre-6.5 structure
293+
return "{category}{major}_{ver}{ext}".format(
294+
category=self.category,
295+
major=qt_version_no_dots[0],
296+
ver=qt_version_no_dots,
297+
ext="_" + extension if extension else "",
298+
)
300299

301300
def all_extensions(self, version: Version) -> List[str]:
302301
if self.target == "desktop" and QtRepoProperty.is_in_wasm_range(self.host, version):

tests/test_list.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -443,15 +443,22 @@ def expected_windows_desktop_plus_wasm_5140(is_wasm_threaded: bool) -> Dict:
443443
)
444444
def test_list_wasm_arches(monkeypatch, capsys, host: str, target: str, version: str, arch: str, expect_arches: Set[str]):
445445
def _mock_fetch_http(_, rest_of_url: str, *args, **kwargs) -> str:
446-
if rest_of_url.endswith("Updates.xml"):
446+
447+
if rest_of_url.endswith("wasm_singlethread/Updates.xml"):
448+
if version >= "6.8.0":
449+
return (Path(__file__).parent / "data" / "all_os-680-wasm-single-update.xml").read_text("utf-8")
450+
else:
451+
return (Path(__file__).parent / "data" / "all_os-673-wasm-single-update.xml").read_text("utf-8")
452+
elif rest_of_url.endswith("wasm_multithread/Updates.xml"):
447453
if version >= "6.8.0":
448-
return (Path(__file__).parent / "data" / "windows-680-wasm-single-update.xml").read_text("utf-8")
454+
return (Path(__file__).parent / "data" / "all_os-680-wasm-multi-update.xml").read_text("utf-8")
449455
else:
450-
return (Path(__file__).parent / "data" / "windows-673-wasm-single-update.xml").read_text("utf-8")
456+
return (Path(__file__).parent / "data" / "all_os-673-wasm-multi-update.xml").read_text("utf-8")
451457
return "" # Return empty HTML since we don't need it
452458

453459
monkeypatch.setattr("aqt.metadata.getUrl", _mock_fetch_http)
454-
monkeypatch.setattr("aqt.metadata.MetadataFactory.fetch_http", _mock_fetch_http)
460+
# monkeypatch.setattr("aqt.metadata.fetch_http", _mock_fetch_http)
461+
monkeypatch.setattr(MetadataFactory, "fetch_http", _mock_fetch_http)
455462

456463
cli = Cli()
457464
cli._setup_settings()
@@ -472,7 +479,6 @@ def _mock_fetch_http(_, rest_of_url: str, *args, **kwargs) -> str:
472479
("--modules 5.14.0 win64_msvc2017_64", False, ["modules_by_arch", "win64_msvc2017_64"]),
473480
("--modules 6.5.0 wasm_singlethread", True, ["modules_by_arch", "wasm_singlethread"]),
474481
("--modules 6.5.0 wasm_multithread", True, ["modules_by_arch", "wasm_multithread"]),
475-
("--arch latest", True, ["architectures"]),
476482
("--spec 5.14 --arch latest", False, ["architectures"]),
477483
("--arch 5.14.0", False, ["architectures"]),
478484
),
@@ -529,7 +535,7 @@ def get_xml_filename() -> str:
529535
assert output_set == expect_set
530536

531537

532-
def test_list_missing_wasm_updates(monkeypatch, capsys):
538+
def test_list_missing_wasm_updates_for_windows(monkeypatch, capsys):
533539
"""Require that MetadataFactory is resilient to missing wasm updates.xml files"""
534540
data_dir = Path(__file__).parent / "data"
535541
expect = set(json.loads((data_dir / "windows-620-expect.json").read_text("utf-8"))["architectures"])

0 commit comments

Comments
 (0)