From 4b7b8818082a059eefabe62b0a23985dc5381049 Mon Sep 17 00:00:00 2001 From: Stanislav Levin Date: Wed, 27 May 2026 20:15:15 +0300 Subject: [PATCH 1/2] tests: sync expected error message for click 8.4.0 `click` `8.4.0` changed the error hint message and prefers long option name over the short one. https://github.com/pallets/click/releases/tag/8.4.0 > The error hint now uses Command.get_help_option_names to pick non-shadowed help option names, so Try '... -h' no longer points to a subcommand option that shadows -h. All surviving names are shown (-h/--help). #2790 #3208 Fixes: https://github.com/domdfcoding/consolekit/issues/132 Signed-off-by: Stanislav Levin --- tests/test_commands_/test_suggestion_group_failure.md | 2 +- tests/test_commands_/test_suggestion_group_success.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_commands_/test_suggestion_group_failure.md b/tests/test_commands_/test_suggestion_group_failure.md index 113893c..08740e3 100644 --- a/tests/test_commands_/test_suggestion_group_failure.md +++ b/tests/test_commands_/test_suggestion_group_failure.md @@ -1,4 +1,4 @@ Usage: demo [OPTIONS] COMMAND [ARGS]... -Try 'demo -h' for help. +Try 'demo --help' for help. Error: No such command 'list'. diff --git a/tests/test_commands_/test_suggestion_group_success.md b/tests/test_commands_/test_suggestion_group_success.md index a2c0883..a69e3bb 100644 --- a/tests/test_commands_/test_suggestion_group_success.md +++ b/tests/test_commands_/test_suggestion_group_success.md @@ -1,5 +1,5 @@ Usage: demo [OPTIONS] COMMAND [ARGS]... -Try 'demo -h' for help. +Try 'demo --help' for help. Error: No such command 'searh'. The most similar command is 'search'. From 3d0b9ff0bfd20dc4499fec978002c3884aea9ccf Mon Sep 17 00:00:00 2001 From: Dominic Davis-Foster Date: Thu, 28 May 2026 13:39:38 +0100 Subject: [PATCH 2/2] Split expected test output for pre/post click 8.4 --- tests/test_commands.py | 16 +++++++++++++++- ...e.md => test_suggestion_group_84__failure.md} | 0 ...s.md => test_suggestion_group_84__success.md} | 0 .../test_suggestion_group_pre_84__failure.md | 4 ++++ .../test_suggestion_group_pre_84__success.md | 5 +++++ 5 files changed, 24 insertions(+), 1 deletion(-) rename tests/test_commands_/{test_suggestion_group_failure.md => test_suggestion_group_84__failure.md} (100%) rename tests/test_commands_/{test_suggestion_group_success.md => test_suggestion_group_84__success.md} (100%) create mode 100644 tests/test_commands_/test_suggestion_group_pre_84__failure.md create mode 100644 tests/test_commands_/test_suggestion_group_pre_84__success.md diff --git a/tests/test_commands.py b/tests/test_commands.py index a5a1660..516c337 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -14,7 +14,7 @@ from consolekit import CONTEXT_SETTINGS, click_command, click_group from consolekit.options import colour_option from consolekit.terminal_colours import ColourTrilean -from consolekit.testing import CliRunner +from consolekit.testing import CliRunner, click_version @pytest.fixture() @@ -294,9 +294,23 @@ def test_markdown_help_group_no_args_is_help( assert result.exit_code == 0 +@pytest.mark.parametrize( + "click_version", + [ + pytest.param( + "pre_84", + marks=pytest.mark.skipif(click_version >= (8, 4), reason="Output differs on click 8.4"), + ), + pytest.param( + "84", + marks=pytest.mark.skipif(click_version < (8, 4), reason="Output differs on click 8.4"), + ), + ], + ) def test_suggestion_group( advanced_file_regression: AdvancedFileRegressionFixture, cli_runner: CliRunner, + click_version: str, ): @click_group(context_settings={**CONTEXT_SETTINGS, "token_normalize_func": lambda x: x.lower()}) diff --git a/tests/test_commands_/test_suggestion_group_failure.md b/tests/test_commands_/test_suggestion_group_84__failure.md similarity index 100% rename from tests/test_commands_/test_suggestion_group_failure.md rename to tests/test_commands_/test_suggestion_group_84__failure.md diff --git a/tests/test_commands_/test_suggestion_group_success.md b/tests/test_commands_/test_suggestion_group_84__success.md similarity index 100% rename from tests/test_commands_/test_suggestion_group_success.md rename to tests/test_commands_/test_suggestion_group_84__success.md diff --git a/tests/test_commands_/test_suggestion_group_pre_84__failure.md b/tests/test_commands_/test_suggestion_group_pre_84__failure.md new file mode 100644 index 0000000..113893c --- /dev/null +++ b/tests/test_commands_/test_suggestion_group_pre_84__failure.md @@ -0,0 +1,4 @@ +Usage: demo [OPTIONS] COMMAND [ARGS]... +Try 'demo -h' for help. + +Error: No such command 'list'. diff --git a/tests/test_commands_/test_suggestion_group_pre_84__success.md b/tests/test_commands_/test_suggestion_group_pre_84__success.md new file mode 100644 index 0000000..a2c0883 --- /dev/null +++ b/tests/test_commands_/test_suggestion_group_pre_84__success.md @@ -0,0 +1,5 @@ +Usage: demo [OPTIONS] COMMAND [ARGS]... +Try 'demo -h' for help. + +Error: No such command 'searh'. +The most similar command is 'search'.