Add tool-long-listing to ListCommand

This change adds the ability to list all the 'tool variant names'
alongside the version and release date of the tool.

When using the `aqt list tools` feature, I often find that I need more
information than the tool provides. I often need to know the release
date and the version for each tool, and I can't get that information
without looking up the Updates.xml file. This feature enables me to skip
that part.
This commit is contained in:
David Dalcino
2021-07-09 19:05:08 -07:00
parent 7a2e7faf53
commit 10d4ec02d5
7 changed files with 116 additions and 1 deletions

View File

@@ -3,7 +3,7 @@ import re
from pathlib import Path
import pytest
from semantic_version import Version, SimpleSpec
from semantic_version import SimpleSpec, Version
from aqt import archives, installer
from aqt.archives import ListCommand
@@ -129,6 +129,29 @@ def test_tool_modules(monkeypatch, host: str, target: str, tool_name: str):
assert modules.strings == expect["modules"]
@pytest.mark.parametrize(
"host, target, tool_name",
[
("mac", "desktop", "tools_cmake"),
("mac", "desktop", "tools_ifw"),
("mac", "desktop", "tools_qtcreator"),
],
)
def test_tool_long_listing(monkeypatch, host: str, target: str, tool_name: str):
archive_id = ArchiveId("tools", host, target)
in_file = "{}-{}-{}-update.xml".format(host, target, tool_name)
expect_out_file = "{}-{}-{}-expect.json".format(host, target, tool_name)
_xml = (Path(__file__).parent / "data" / in_file).read_text("utf-8")
expect = json.loads(
(Path(__file__).parent / "data" / expect_out_file).read_text("utf-8")
)
monkeypatch.setattr(archives.ListCommand, "fetch_http", lambda self, _: _xml)
table = ListCommand(archive_id).fetch_tool_long_listing(tool_name)
assert table.rows == expect["long_listing"]
@pytest.mark.parametrize(
"cat, host, target, minor_ver, ver, ext, xmlfile, xmlexpect, htmlfile, htmlexpect",
[