@@ -733,10 +733,15 @@ def cli(foo, bar):
733
733
assert "bar" not in result .output
734
734
735
735
736
- def test_help_option (runner ):
736
+ @pytest .mark .parametrize ('param_decls, options, output' , [
737
+ ((), ['--help' ], '--help' ),
738
+ (('-h' , '--help' ), ['-h' ], '-h, --help' ),
739
+ (('-h' , '--help' ), ['--help' ], '-h, --help' ),
740
+ ])
741
+ def test_help_option (runner , param_decls , options , output ):
737
742
@click .command ()
738
743
@optgroup ('Help Options' )
739
- @optgroup .help_option ('-h' , '--help' )
744
+ @optgroup .help_option (* param_decls )
740
745
def cli () -> None :
741
746
click .echo ('Running command.' )
742
747
@@ -745,11 +750,11 @@ def cli() -> None:
745
750
assert 'Running command.' in result .output
746
751
assert 'Usage:' not in result .output
747
752
748
- result = runner .invoke (cli , [ '-h' ] )
753
+ result = runner .invoke (cli , options )
749
754
assert not result .exception
750
755
assert 'Running command.' not in result .output
751
756
assert 'Usage:' in result .output
752
- assert '-h, --help' in result .output
757
+ assert output in result .output
753
758
754
759
755
760
def test_wrapped_functions (runner ):
0 commit comments