| 58 | |
| 59 | |
| 60 | def test_basic_group(runner): |
| 61 | @click.group() |
| 62 | def cli(): |
| 63 | """This is the root.""" |
| 64 | click.echo("ROOT EXECUTED") |
| 65 | |
| 66 | @cli.command() |
| 67 | def subcommand(): |
| 68 | """This is a subcommand.""" |
| 69 | click.echo("SUBCOMMAND EXECUTED") |
| 70 | |
| 71 | result = runner.invoke(cli, ["--help"]) |
| 72 | assert not result.exception |
| 73 | assert "COMMAND [ARGS]..." in result.output |
| 74 | assert "This is the root" in result.output |
| 75 | assert "This is a subcommand." in result.output |
| 76 | assert result.exit_code == 0 |
| 77 | assert "ROOT EXECUTED" not in result.output |
| 78 | |
| 79 | result = runner.invoke(cli, ["subcommand"]) |
| 80 | assert not result.exception |
| 81 | assert result.exit_code == 0 |
| 82 | assert "ROOT EXECUTED" in result.output |
| 83 | assert "SUBCOMMAND EXECUTED" in result.output |
| 84 | |
| 85 | |
| 86 | def test_group_commands_dict(runner): |