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_84__failure.md b/tests/test_commands_/test_suggestion_group_84__failure.md new file mode 100644 index 0000000..08740e3 --- /dev/null +++ b/tests/test_commands_/test_suggestion_group_84__failure.md @@ -0,0 +1,4 @@ +Usage: demo [OPTIONS] COMMAND [ARGS]... +Try 'demo --help' for help. + +Error: No such command 'list'. diff --git a/tests/test_commands_/test_suggestion_group_84__success.md b/tests/test_commands_/test_suggestion_group_84__success.md new file mode 100644 index 0000000..a69e3bb --- /dev/null +++ b/tests/test_commands_/test_suggestion_group_84__success.md @@ -0,0 +1,5 @@ +Usage: demo [OPTIONS] COMMAND [ARGS]... +Try 'demo --help' for help. + +Error: No such command 'searh'. +The most similar command is 'search'. diff --git a/tests/test_commands_/test_suggestion_group_failure.md b/tests/test_commands_/test_suggestion_group_pre_84__failure.md similarity index 100% rename from tests/test_commands_/test_suggestion_group_failure.md rename to tests/test_commands_/test_suggestion_group_pre_84__failure.md diff --git a/tests/test_commands_/test_suggestion_group_success.md b/tests/test_commands_/test_suggestion_group_pre_84__success.md similarity index 100% rename from tests/test_commands_/test_suggestion_group_success.md rename to tests/test_commands_/test_suggestion_group_pre_84__success.md