Skip to content
Myr

Fixed a bug with forwarding and added a test

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 de338be · Browse files · 2 files+23 added−3 removed
This commit

State

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

Diff stats

2 files+23 added−3 removed

  • tests:+20 added−0 removed
  • other:+3 added−3 removed

2 files+23 added−3 removed

modified:click/core.py+3 added-3 removed
242 unmodified lines
243 if not isinstance(cmd, Command):244 raise TypeError('Callback is not a command.')245246 for param in self.params:247 if param.name in self.params and \248 param.name not in kwargs:249 kwargs[param.name] = self.params[param.name]247 if param in self.params and \248 param not in kwargs:249 kwargs[param] = self.params[param]250251 return self.invoke(cmd, **kwargs)252253
827 unmodified lines
modified:tests/test_commands.py+20 added
17 unmodified lines
18 assert not result.exception19 assert result.output == '42\n'202122def test_other_command_forward(runner):23 cli = click.Group()2425 @cli.command()26 @click.option('--count', default=1)27 def test(count):28 click.echo('Count: %d' % count)2930 @cli.command()31 @click.option('--count', default=1)32 @click.pass_context33 def dist(ctx, count):34 ctx.forward(test)35 ctx.invoke(test, count=42)3637 result = runner.invoke(cli, ['dist'])38 assert not result.exception39 assert result.output == 'Count: 1\nCount: 42\n'404142def test_auto_shorthelp(runner):43 @click.group()44 def cli():45 pass
33 unmodified lines