mirror of
https://github.com/miurahr/aqtinstall.git
synced 2025-12-17 04:34:37 +03:00
Add cli tests for long_modules and modules with archives
This should cover the new lines of uncovered code in this PR.
This commit is contained in:
committed by
Hiroshi Miura
parent
dfa6733a0b
commit
24f6d9ddca
@@ -77,7 +77,7 @@ LIST_OF_FILES_AND_CONTENTS = Iterable[Dict[str, str]]
|
||||
class PatchedFile:
|
||||
filename: str
|
||||
unpatched_content: str
|
||||
patched_content: Optional[str]
|
||||
patched_content: Optional[str] = None # When None, the file is expected not to be patched.
|
||||
|
||||
def expected_content(self, **kwargs) -> str:
|
||||
if not self.patched_content:
|
||||
@@ -349,6 +349,41 @@ def tool_archive(host: str, tool_name: str, variant: str, date: datetime = datet
|
||||
r"INFO : Time elapsed: .* second"
|
||||
),
|
||||
),
|
||||
( # Mixing --modules with --archives
|
||||
"install-qt windows desktop 5.14.0 win32_mingw73 -m qtcharts --archives qtbase".split(),
|
||||
"windows",
|
||||
"desktop",
|
||||
"5.14.0",
|
||||
{"std": "win32_mingw73"},
|
||||
{"std": "mingw73_32"},
|
||||
{"std": "windows_x86/desktop/qt5_5140/Updates.xml"},
|
||||
{
|
||||
"std": [
|
||||
plain_qtbase_archive("qt.qt5.5140.win32_mingw73", "win32_mingw73"),
|
||||
MockArchive(
|
||||
filename_7z="qtcharts-windows-win32_mingw73.7z",
|
||||
update_xml_name="qt.qt5.5140.qtcharts.win32_mingw73",
|
||||
contents=(PatchedFile(filename="lib/qtcharts.h", unpatched_content="... charts ...\n"),),
|
||||
should_install=True,
|
||||
),
|
||||
MockArchive(
|
||||
filename_7z="qtlottie-windows-win32_mingw73.7z",
|
||||
update_xml_name="qt.qt5.5140.qtlottie.win32_mingw73",
|
||||
contents=(PatchedFile(filename="lib/qtlottie.h", unpatched_content="... lottie ...\n"),),
|
||||
should_install=False,
|
||||
),
|
||||
]
|
||||
},
|
||||
re.compile(
|
||||
r"^INFO : aqtinstall\(aqt\) v.* on Python 3.*\n"
|
||||
r"INFO : Downloading qtbase...\n"
|
||||
r"Finished installation of qtbase-windows-win32_mingw73.7z in .*\n"
|
||||
r"INFO : Downloading qtcharts...\n"
|
||||
r"Finished installation of qtcharts-windows-win32_mingw73.7z in .*\n"
|
||||
r"INFO : Finished installation\n"
|
||||
r"INFO : Time elapsed: .* second"
|
||||
),
|
||||
),
|
||||
(
|
||||
"install-src windows desktop 5.14.2".split(),
|
||||
"windows",
|
||||
|
||||
@@ -865,38 +865,21 @@ def test_show_list_tools_long_ifw(capsys, monkeypatch, columns, expect):
|
||||
assert out == expect
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"columns, expect",
|
||||
(
|
||||
(
|
||||
120,
|
||||
" Module Name Display Name Release Date Download Size "
|
||||
"Installed Size\n"
|
||||
"======================================================================================================"
|
||||
"==============\n"
|
||||
"qtcharts Qt Charts for MinGW 7.3.0 32-bit 2019-12-11 772.7K "
|
||||
"7.8M \n"
|
||||
"qtdatavis3d Qt Data Visualization for MinGW 7.3.0 32-bit 2019-12-11 620.2K "
|
||||
"5.0M \n"
|
||||
"qtlottie Qt Lottie Animation for MinGW 7.3.0 32-bit 2019-12-11 153.5K "
|
||||
"968.4K \n"
|
||||
"qtnetworkauth Qt Network Authorization for MinGW 7.3.0 32-bit 2019-12-11 98.7K "
|
||||
"638.6K \n"
|
||||
"qtpurchasing Qt Purchasing for MinGW 7.3.0 32-bit 2019-12-11 50.9K "
|
||||
"306.8K \n"
|
||||
"qtquick3d Qt Quick 3D for MinGW 7.3.0 32-bit 2019-12-11 9.8M "
|
||||
"21.2M \n"
|
||||
"qtquicktimeline Qt Quick Timeline for MinGW 7.3.0 32-bit 2019-12-11 35.3K "
|
||||
"154.1K \n"
|
||||
"qtscript Qt Script for MinGW 7.3.0 32-bit 2019-12-11 1.0M "
|
||||
"5.5M \n"
|
||||
"qtvirtualkeyboard Qt Virtual Keyboard for MinGW 7.3.0 32-bit 2019-12-11 2.1M "
|
||||
"6.8M \n"
|
||||
"qtwebglplugin Qt WebGL Streaming Plugin for MinGW 7.3.0 32-bit 2019-12-11 201.7K "
|
||||
"1.0M \n",
|
||||
),
|
||||
(
|
||||
80,
|
||||
LONG_MODULES_WIN_5140_120 = (
|
||||
" Module Name Display Name Release Date Download Size Installed Size\n"
|
||||
"====================================================================================================================\n"
|
||||
"qtcharts Qt Charts for MinGW 7.3.0 32-bit 2019-12-11 772.7K 7.8M \n"
|
||||
"qtdatavis3d Qt Data Visualization for MinGW 7.3.0 32-bit 2019-12-11 620.2K 5.0M \n"
|
||||
"qtlottie Qt Lottie Animation for MinGW 7.3.0 32-bit 2019-12-11 153.5K 968.4K \n"
|
||||
"qtnetworkauth Qt Network Authorization for MinGW 7.3.0 32-bit 2019-12-11 98.7K 638.6K \n"
|
||||
"qtpurchasing Qt Purchasing for MinGW 7.3.0 32-bit 2019-12-11 50.9K 306.8K \n"
|
||||
"qtquick3d Qt Quick 3D for MinGW 7.3.0 32-bit 2019-12-11 9.8M 21.2M \n"
|
||||
"qtquicktimeline Qt Quick Timeline for MinGW 7.3.0 32-bit 2019-12-11 35.3K 154.1K \n"
|
||||
"qtscript Qt Script for MinGW 7.3.0 32-bit 2019-12-11 1.0M 5.5M \n"
|
||||
"qtvirtualkeyboard Qt Virtual Keyboard for MinGW 7.3.0 32-bit 2019-12-11 2.1M 6.8M \n"
|
||||
"qtwebglplugin Qt WebGL Streaming Plugin for MinGW 7.3.0 32-bit 2019-12-11 201.7K 1.0M \n"
|
||||
)
|
||||
LONG_MODULES_WIN_5140_80 = (
|
||||
" Module Name Display Name \n"
|
||||
"====================================================================\n"
|
||||
"qtcharts Qt Charts for MinGW 7.3.0 32-bit \n"
|
||||
@@ -908,16 +891,32 @@ def test_show_list_tools_long_ifw(capsys, monkeypatch, columns, expect):
|
||||
"qtquicktimeline Qt Quick Timeline for MinGW 7.3.0 32-bit \n"
|
||||
"qtscript Qt Script for MinGW 7.3.0 32-bit \n"
|
||||
"qtvirtualkeyboard Qt Virtual Keyboard for MinGW 7.3.0 32-bit \n"
|
||||
"qtwebglplugin Qt WebGL Streaming Plugin for MinGW 7.3.0 32-bit\n",
|
||||
),
|
||||
"qtwebglplugin Qt WebGL Streaming Plugin for MinGW 7.3.0 32-bit\n"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"columns, use_cli, expect",
|
||||
(
|
||||
(120, False, LONG_MODULES_WIN_5140_120),
|
||||
(80, False, LONG_MODULES_WIN_5140_80),
|
||||
(120, True, LONG_MODULES_WIN_5140_120),
|
||||
(80, True, LONG_MODULES_WIN_5140_80),
|
||||
),
|
||||
)
|
||||
def test_show_list_long_qt_modules(capsys, monkeypatch, columns, expect):
|
||||
def test_show_list_long_qt_modules(capsys, monkeypatch, columns: int, use_cli: bool, expect: str):
|
||||
update_xml = (Path(__file__).parent / "data" / "windows-5140-update.xml").read_text("utf-8")
|
||||
monkeypatch.setattr(MetadataFactory, "fetch_http", lambda self, _: update_xml)
|
||||
|
||||
cli = Cli()
|
||||
|
||||
# Patching get_terminal_size prevents successful instantiation of Cli, so do it afterwards:
|
||||
monkeypatch.setattr(shutil, "get_terminal_size", lambda fallback: os.terminal_size((columns, 24)))
|
||||
|
||||
if use_cli:
|
||||
return_code = cli.run("list-qt windows desktop --long-modules 5.14.0 win32_mingw73".split())
|
||||
assert return_code == 0
|
||||
else:
|
||||
meta = MetadataFactory(
|
||||
ArchiveId("qt", "windows", "desktop"),
|
||||
modules_query=ModulesQuery("5.14.0", "win32_mingw73"),
|
||||
|
||||
Reference in New Issue
Block a user