Description
get_cli_arg (in exasol/python_extension_common/cli/std_options.py) builds a CLI arg string as:
f'--{option_name} "{param_value}"'
This is later passed as a single string to Click's CliRunner.invoke(args=arg_string), which internally runs shlex.split() on it. If param_value itself starts with -- (e.g. a randomly generated SaaS database id), shlex.split strips the surrounding quotes and produces two separate tokens: --option-name and --<value>. Click's parser then treats the second token as a new (unknown) option rather than as the value of the first, raising click.exceptions.NoSuchOption.
How it was found
Discovered via a SaaS integration test failure in CI:
https://github.com/exasol/python-extension-common/actions/runs/30364243440/job/90292362448?pr=164
The randomly generated backend_aware_saas_database_id for that test run happened to be --dI0m90RUKefql382tsWA, which starts with --, tripping up the CLI arg construction:
click.exceptions.NoSuchOption: No such option '--dI0m90RUKefql382tsWA'.
Failing tests:
test/integration/cli/test_language_container_deployer_cli.py::test_slc_deployer_cli_saas_url
test/integration/cli/test_language_container_deployer_cli.py::test_slc_deployer_cli_saas_file
This is not caused by any specific PR's changes — it's a pre-existing latent bug in the CLI-arg-building helper that only surfaces when a value happens to start with --.
Fix
Join the option and its value with = instead of a space, e.g. --option-name="value", so Click cannot split them into separate tokens during shlex.split.
A fix plus regression tests (test_get_cli_arg, test_kwargs_to_cli_args_value_starting_with_dashes in test/unit/cli/test_std_options.py) has been prepared on branch dependency/163-python3.14.
Description
get_cli_arg(inexasol/python_extension_common/cli/std_options.py) builds a CLI arg string as:f'--{option_name} "{param_value}"'This is later passed as a single string to Click's
CliRunner.invoke(args=arg_string), which internally runsshlex.split()on it. Ifparam_valueitself starts with--(e.g. a randomly generated SaaS database id),shlex.splitstrips the surrounding quotes and produces two separate tokens:--option-nameand--<value>. Click's parser then treats the second token as a new (unknown) option rather than as the value of the first, raisingclick.exceptions.NoSuchOption.How it was found
Discovered via a SaaS integration test failure in CI:
https://github.com/exasol/python-extension-common/actions/runs/30364243440/job/90292362448?pr=164
The randomly generated
backend_aware_saas_database_idfor that test run happened to be--dI0m90RUKefql382tsWA, which starts with--, tripping up the CLI arg construction:Failing tests:
test/integration/cli/test_language_container_deployer_cli.py::test_slc_deployer_cli_saas_urltest/integration/cli/test_language_container_deployer_cli.py::test_slc_deployer_cli_saas_fileThis is not caused by any specific PR's changes — it's a pre-existing latent bug in the CLI-arg-building helper that only surfaces when a value happens to start with
--.Fix
Join the option and its value with
=instead of a space, e.g.--option-name="value", so Click cannot split them into separate tokens duringshlex.split.A fix plus regression tests (
test_get_cli_arg,test_kwargs_to_cli_args_value_starting_with_dashesintest/unit/cli/test_std_options.py) has been prepared on branchdependency/163-python3.14.