Skip to content
Myr

Added a test for ignoring of unknown options.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent f239511 · Browse files · 1 file+18 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+18 added−0 removed

  • tests:+18 added−0 removed

1 file+18 added−0 removed

modified:tests/test_commands.py+18 added
250 unmodified lines
251252 result = runner.invoke(cli)253 assert not result.exception254 assert result.output == 'no subcommand, use default\nin subcommand\n'255256257def test_unprocessed_options(runner):258 @click.command(context_settings=dict(259 ignore_unknown_options=True260 ))261 @click.argument('args', nargs=-1, type=click.UNPROCESSED)262 @click.option('--verbose', '-v', count=True)263 def cli(verbose, args):264 click.echo('Verbosity: %s' % verbose)265 click.echo('Args: %s' % '|'.join(args))266267 result = runner.invoke(cli, ['-foo', '-vvvvx', '--muhaha', 'x', 'y', '-x'])268 assert not result.exception269 assert result.output.splitlines() == [270 'Verbosity: 4',271 'Args: -foo|-x|--muhaha|x|y|-x',272 ]