mirror of
https://github.com/miurahr/aqtinstall.git
synced 2025-12-18 13:14:37 +03:00
test: cli: Update test expectation
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
This commit is contained in:
@@ -72,7 +72,8 @@ class Cli:
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
prog="aqt",
|
prog="aqt",
|
||||||
description="Installer for Qt SDK.",
|
description="Another unoffical Qt Installer.\n"
|
||||||
|
"aqt help you install Qt SDK, tools, examples and others\n",
|
||||||
formatter_class=argparse.RawTextHelpFormatter,
|
formatter_class=argparse.RawTextHelpFormatter,
|
||||||
add_help=True,
|
add_help=True,
|
||||||
)
|
)
|
||||||
@@ -84,8 +85,11 @@ class Cli:
|
|||||||
)
|
)
|
||||||
subparsers = parser.add_subparsers(
|
subparsers = parser.add_subparsers(
|
||||||
title="subcommands",
|
title="subcommands",
|
||||||
description="Valid subcommands",
|
description="aqt accept several subcommands\n"
|
||||||
help="subcommand for aqt Qt installer",
|
"install-* subcommands are installer of components\n"
|
||||||
|
"list-* subcommands are show available compoenets\n\n"
|
||||||
|
"commands {install|tool|src|examples|doc} are oblesolete now\n",
|
||||||
|
help="Please refer each help message shown with --help argument for each subcommands",
|
||||||
)
|
)
|
||||||
self._make_install_parsers(subparsers)
|
self._make_install_parsers(subparsers)
|
||||||
self._make_list_qt_parser(subparsers)
|
self._make_list_qt_parser(subparsers)
|
||||||
@@ -617,22 +621,22 @@ class Cli:
|
|||||||
"arch",
|
"arch",
|
||||||
nargs="?",
|
nargs="?",
|
||||||
help="\ntarget linux/desktop: gcc_64, wasm_32"
|
help="\ntarget linux/desktop: gcc_64, wasm_32"
|
||||||
"\ntarget mac/desktop: clang_64, wasm_32"
|
"\ntarget mac/desktop: clang_64, wasm_32"
|
||||||
"\ntarget mac/ios: ios"
|
"\ntarget mac/ios: ios"
|
||||||
"\nwindows/desktop: win64_msvc2019_64, win32_msvc2019"
|
"\nwindows/desktop: win64_msvc2019_64, win32_msvc2019"
|
||||||
"\n win64_msvc2017_64, win32_msvc2017"
|
"\n win64_msvc2017_64, win32_msvc2017"
|
||||||
"\n win64_msvc2015_64, win32_msvc2015"
|
"\n win64_msvc2015_64, win32_msvc2015"
|
||||||
"\n win64_mingw81, win32_mingw81"
|
"\n win64_mingw81, win32_mingw81"
|
||||||
"\n win64_mingw73, win32_mingw73"
|
"\n win64_mingw73, win32_mingw73"
|
||||||
"\n win32_mingw53"
|
"\n win32_mingw53"
|
||||||
"\n wasm_32"
|
"\n wasm_32"
|
||||||
"\nwindows/winrt: win64_msvc2019_winrt_x64, win64_msvc2019_winrt_x86"
|
"\nwindows/winrt: win64_msvc2019_winrt_x64, win64_msvc2019_winrt_x86"
|
||||||
"\n win64_msvc2017_winrt_x64, win64_msvc2017_winrt_x86"
|
"\n win64_msvc2017_winrt_x64, win64_msvc2017_winrt_x86"
|
||||||
"\n win64_msvc2019_winrt_armv7"
|
"\n win64_msvc2019_winrt_armv7"
|
||||||
"\n win64_msvc2017_winrt_armv7"
|
"\n win64_msvc2017_winrt_armv7"
|
||||||
"\nandroid: Qt 5.14: android (optional)"
|
"\nandroid: Qt 5.14: android (optional)"
|
||||||
"\n Qt 5.13 or below: android_x86_64, android_arm64_v8a"
|
"\n Qt 5.13 or below: android_x86_64, android_arm64_v8a"
|
||||||
"\n android_x86, android_armv7",
|
"\n android_x86, android_armv7",
|
||||||
)
|
)
|
||||||
self._set_module_options(install_qt_parser)
|
self._set_module_options(install_qt_parser)
|
||||||
install_qt_parser.add_argument(
|
install_qt_parser.add_argument(
|
||||||
@@ -660,11 +664,10 @@ class Cli:
|
|||||||
nargs="?",
|
nargs="?",
|
||||||
default=None,
|
default=None,
|
||||||
help="Name of full tool name such as qt.tools.ifw.31. "
|
help="Name of full tool name such as qt.tools.ifw.31. "
|
||||||
"Please use 'aqt list-tool' to list acceptable values for this parameter.",
|
"Please use 'aqt list-tool' to list acceptable values for this parameter.",
|
||||||
)
|
)
|
||||||
self._set_common_options(install_tool_parser)
|
self._set_common_options(install_tool_parser)
|
||||||
|
|
||||||
|
|
||||||
def _make_legacy_parsers(self, subparsers: argparse._SubParsersAction):
|
def _make_legacy_parsers(self, subparsers: argparse._SubParsersAction):
|
||||||
install_parser = subparsers.add_parser(
|
install_parser = subparsers.add_parser(
|
||||||
"install", formatter_class=argparse.RawTextHelpFormatter
|
"install", formatter_class=argparse.RawTextHelpFormatter
|
||||||
@@ -674,9 +677,10 @@ class Cli:
|
|||||||
self._set_install_tool_parser(tool_parser)
|
self._set_install_tool_parser(tool_parser)
|
||||||
#
|
#
|
||||||
for cmd, f in (
|
for cmd, f in (
|
||||||
("doc", self.run_install_doc),
|
("doc", self.run_install_doc),
|
||||||
("example", self.run_install_example),
|
("example", self.run_install_example),
|
||||||
("src", self.run_install_src)):
|
("src", self.run_install_src),
|
||||||
|
):
|
||||||
p = subparsers.add_parser(cmd)
|
p = subparsers.add_parser(cmd)
|
||||||
p.set_defaults(func=f)
|
p.set_defaults(func=f)
|
||||||
self._set_common_argument(p)
|
self._set_common_argument(p)
|
||||||
@@ -692,8 +696,9 @@ class Cli:
|
|||||||
self._set_install_tool_parser(tool_parser)
|
self._set_install_tool_parser(tool_parser)
|
||||||
#
|
#
|
||||||
for cmd, f in (
|
for cmd, f in (
|
||||||
("install-doc", self.run_install_doc),
|
("install-doc", self.run_install_doc),
|
||||||
("install-example", self.run_install_example)):
|
("install-example", self.run_install_example),
|
||||||
|
):
|
||||||
p = subparsers.add_parser(cmd)
|
p = subparsers.add_parser(cmd)
|
||||||
p.set_defaults(func=f)
|
p.set_defaults(func=f)
|
||||||
self._set_common_argument(p)
|
self._set_common_argument(p)
|
||||||
|
|||||||
@@ -11,9 +11,12 @@ def test_cli_help(capsys):
|
|||||||
expected = "".join(
|
expected = "".join(
|
||||||
[
|
[
|
||||||
"usage: aqt [-h] [-c CONFIG]\n",
|
"usage: aqt [-h] [-c CONFIG]\n",
|
||||||
" {install,doc,examples,src,tool,list-qt,list-tool,help,version} ...\n",
|
" {install-qt,install-tool,install-doc,install-example,install-src,list-qt,list-tool,",
|
||||||
|
"install,tool,doc,example,src,help,version}\n",
|
||||||
|
" ...\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Installer for Qt SDK.\n",
|
"Another unoffical Qt Installer.\n",
|
||||||
|
"aqt help you install Qt SDK, tools, examples and others\n",
|
||||||
"\n",
|
"\n",
|
||||||
"optional arguments:\n",
|
"optional arguments:\n",
|
||||||
" -h, --help show this help message and exit\n",
|
" -h, --help show this help message and exit\n",
|
||||||
@@ -21,10 +24,15 @@ def test_cli_help(capsys):
|
|||||||
" Configuration ini file.\n",
|
" Configuration ini file.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"subcommands:\n",
|
"subcommands:\n",
|
||||||
" Valid subcommands\n",
|
" aqt accept several subcommands\n",
|
||||||
|
" install-* subcommands are installer of components\n",
|
||||||
|
" list-* subcommands are show available compoenets\n",
|
||||||
|
" \n",
|
||||||
|
" commands {install|tool|src|examples|doc} are oblesolete now\n",
|
||||||
"\n",
|
"\n",
|
||||||
" {install,doc,examples,src,tool,list-qt,list-tool,help,version}\n",
|
" {install-qt,install-tool,install-doc,install-example,install-src,list-qt,list-tool,",
|
||||||
" subcommand for aqt Qt installer\n",
|
"install,tool,doc,example,src,help,version}\n",
|
||||||
|
" Please refer each help message shown with --help argument for each subcommands\n",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
cli = Cli()
|
cli = Cli()
|
||||||
@@ -79,8 +87,8 @@ def test_cli_invalid_version(capsys, invalid_version):
|
|||||||
)
|
)
|
||||||
|
|
||||||
for cmd in (
|
for cmd in (
|
||||||
("install", invalid_version, "mac", "desktop"),
|
("install-qt", invalid_version, "mac", "desktop"),
|
||||||
("doc", invalid_version, "mac", "desktop"),
|
("install-doc", invalid_version, "mac", "desktop"),
|
||||||
("list-qt", "mac", "desktop", "--modules", invalid_version),
|
("list-qt", "mac", "desktop", "--modules", invalid_version),
|
||||||
):
|
):
|
||||||
with pytest.raises(SystemExit) as pytest_wrapped_e:
|
with pytest.raises(SystemExit) as pytest_wrapped_e:
|
||||||
@@ -102,29 +110,3 @@ def test_cli_check_mirror():
|
|||||||
args = cli.parser.parse_args(arg)
|
args = cli.parser.parse_args(arg)
|
||||||
assert args.base == "https://download.qt.io/"
|
assert args.base == "https://download.qt.io/"
|
||||||
assert cli._check_mirror(args.base)
|
assert cli._check_mirror(args.base)
|
||||||
|
|
||||||
|
|
||||||
def test_cli_launch_with_no_argument(capsys):
|
|
||||||
expected = "".join(
|
|
||||||
[
|
|
||||||
"usage: aqt [-h] [-c CONFIG]\n",
|
|
||||||
" {install,doc,examples,src,tool,list-qt,list-tool,help,version} ...\n",
|
|
||||||
"\n",
|
|
||||||
"Installer for Qt SDK.\n",
|
|
||||||
"\n",
|
|
||||||
"optional arguments:\n",
|
|
||||||
" -h, --help show this help message and exit\n",
|
|
||||||
" -c CONFIG, --config CONFIG\n",
|
|
||||||
" Configuration ini file.\n",
|
|
||||||
"\n",
|
|
||||||
"subcommands:\n",
|
|
||||||
" Valid subcommands\n",
|
|
||||||
"\n",
|
|
||||||
" {install,doc,examples,src,tool,list-qt,list-tool,help,version}\n",
|
|
||||||
" subcommand for aqt Qt installer\n",
|
|
||||||
]
|
|
||||||
)
|
|
||||||
cli = Cli()
|
|
||||||
cli.run([])
|
|
||||||
out, err = capsys.readouterr()
|
|
||||||
assert out == expected
|
|
||||||
|
|||||||
Reference in New Issue
Block a user