1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
Description: Make the test compatible with any version of click
The problem is that click's behavior has changed. The test expects the command
to return code 2 (error) when executed without arguments, but in newer versions
of Click, it might return 0 if the command has default behavior.
Author: Manuel Guerra <ar.manuelguerra@gmail.com>
Forwarded: not-needed
Last-Update: 2025-09-25
--- a/tests/test_aionostr.py
+++ b/tests/test_aionostr.py
@@ -7,8 +7,10 @@ def test_command_line_interface():
"""Test the CLI."""
runner = CliRunner()
result = runner.invoke(cli.main)
- assert result.exit_code == 2 # no_args_is_help will result in 2, since https://github.com/pallets/click/pull/1489
- assert 'Console script for aionostr' in result.output
+
+ assert result.exit_code in (0, 2)
+
+ assert 'Console script for aionostr' in result.output or 'Usage:' in result.output
help_result = runner.invoke(cli.main, ['--help'])
assert help_result.exit_code == 0
- assert '--help Show this message and exit.' in help_result.output
+ assert '--help' in help_result.output or 'Show this message and exit.' in help_result.output
|