From 3d431981ca0debac75aaa0821d21a43cd910aede Mon Sep 17 00:00:00 2001 From: nishad shabbir Date: Fri, 23 Oct 2026 21:53:44 +0530 Subject: [PATCH] GH-55161: [Dev] Make archery integration --with-all enable every implementation --with-all was accepted and then ignored. It is bound as an explicit parameter of integration(), which also keeps it out of **args, so neither the body nor select_testers() ever saw it. With every --with- option declared default=False, select_testers() always received an explicit False for each one and its own permissive defaults never applied, so the command documented in format/Integration.rst failed with "Need to enable at least one implementation to test". Give the --with- options default=None so that "not given" stays distinguishable from an explicit --with-java=0, then fall back to the value of --with-all for the ones left unset. This is what the _set_default helper sitting above the command was written for; it had never been called. --- dev/archery/archery/cli.py | 22 +++++++++----- dev/archery/archery/tests/test_cli.py | 42 +++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 8 deletions(-) diff --git a/dev/archery/archery/cli.py b/dev/archery/archery/cli.py index e7dcc819500f..1fa90e22ec1f 100644 --- a/dev/archery/archery/cli.py +++ b/dev/archery/archery/cli.py @@ -712,28 +712,28 @@ def _set_default(opt, default): 'in integration tests')) @click.option('--random-seed', type=int, default=12345, help="Seed for PRNG when generating test data") -@click.option('--with-cpp', type=bool, default=False, +@click.option('--with-cpp', type=bool, default=None, help='Include C++ in integration tests', envvar="ARCHERY_INTEGRATION_WITH_CPP") -@click.option('--with-dotnet', type=bool, default=False, +@click.option('--with-dotnet', type=bool, default=None, help='Include .NET in integration tests', envvar="ARCHERY_INTEGRATION_WITH_DOTNET") -@click.option('--with-java', type=bool, default=False, +@click.option('--with-java', type=bool, default=None, help='Include Java in integration tests', envvar="ARCHERY_INTEGRATION_WITH_JAVA") -@click.option('--with-js', type=bool, default=False, +@click.option('--with-js', type=bool, default=None, help='Include JavaScript in integration tests', envvar="ARCHERY_INTEGRATION_WITH_JS") -@click.option('--with-go', type=bool, default=False, +@click.option('--with-go', type=bool, default=None, help='Include Go in integration tests', envvar="ARCHERY_INTEGRATION_WITH_GO") -@click.option('--with-nanoarrow', type=bool, default=False, +@click.option('--with-nanoarrow', type=bool, default=None, help='Include nanoarrow in integration tests', envvar="ARCHERY_INTEGRATION_WITH_NANOARROW") -@click.option('--with-ruby', type=bool, default=False, +@click.option('--with-ruby', type=bool, default=None, help='Include Ruby in integration tests', envvar="ARCHERY_INTEGRATION_WITH_RUBY") -@click.option('--with-rust', type=bool, default=False, +@click.option('--with-rust', type=bool, default=None, help='Include Rust in integration tests', envvar="ARCHERY_INTEGRATION_WITH_RUST") @click.option('--target-implementations', default='', @@ -842,6 +842,12 @@ def integration(with_all=False, random_seed=12345, write_generated_json="", param = f'run_{fmt}' enabled_formats += args[param] + # --with-all only supplies the default for the individual --with- + # options, which is why those default to None: it keeps "not given" apart + # from an explicit "--with-java=0", so the explicit value still wins. + for name in [key for key in args if key.startswith('with_')]: + args[name] = _set_default(args[name], with_all) + testers, other_testers = select_testers(**args) if write_generated_json: diff --git a/dev/archery/archery/tests/test_cli.py b/dev/archery/archery/tests/test_cli.py index 3891a2c288d6..ff1967281edc 100644 --- a/dev/archery/archery/tests/test_cli.py +++ b/dev/archery/archery/tests/test_cli.py @@ -37,3 +37,45 @@ def test_linking_check_dependencies(fn): fn.assert_called_once_with( Path('somelib.so'), allowed={'libarrow'}, disallowed={'libcurl'} ) + + +@patch("archery.integration.runner.run_all_tests") +@patch("archery.integration.runner.select_testers") +def test_integration_with_all_enables_every_implementation(select_testers, + run_all_tests): + select_testers.return_value = (["tester"], []) + result = CliRunner().invoke( + archery, ["integration", "--with-all", "--run-ipc"]) + assert result.exit_code == 0 + enabled = {name: value + for name, value in select_testers.call_args.kwargs.items() + if name.startswith("with_")} + assert enabled + assert all(enabled.values()), enabled + + +@patch("archery.integration.runner.run_all_tests") +@patch("archery.integration.runner.select_testers") +def test_integration_with_all_yields_to_an_explicit_option(select_testers, + run_all_tests): + select_testers.return_value = (["tester"], []) + result = CliRunner().invoke( + archery, ["integration", "--with-all", "--with-java=0", "--run-ipc"]) + assert result.exit_code == 0 + kwargs = select_testers.call_args.kwargs + assert kwargs["with_java"] is False + assert kwargs["with_cpp"] is True + + +@patch("archery.integration.runner.run_all_tests") +@patch("archery.integration.runner.select_testers") +def test_integration_without_with_all_enables_nothing(select_testers, + run_all_tests): + select_testers.return_value = (["tester"], []) + result = CliRunner().invoke(archery, ["integration", "--run-ipc"]) + assert result.exit_code == 0 + enabled = {name: value + for name, value in select_testers.call_args.kwargs.items() + if name.startswith("with_")} + assert enabled + assert not any(enabled.values()), enabled