(runner)
| 318 | |
| 319 | |
| 320 | def test_appgroup_app_context(runner): |
| 321 | @click.group(cls=AppGroup) |
| 322 | def cli(): |
| 323 | pass |
| 324 | |
| 325 | @cli.command() |
| 326 | def test(): |
| 327 | click.echo(current_app.name) |
| 328 | |
| 329 | @cli.group() |
| 330 | def subgroup(): |
| 331 | pass |
| 332 | |
| 333 | @subgroup.command() |
| 334 | def test2(): |
| 335 | click.echo(current_app.name) |
| 336 | |
| 337 | obj = ScriptInfo(create_app=lambda: Flask("testappgroup")) |
| 338 | |
| 339 | result = runner.invoke(cli, ["test"], obj=obj) |
| 340 | assert result.exit_code == 0 |
| 341 | assert result.output == "testappgroup\n" |
| 342 | |
| 343 | result = runner.invoke(cli, ["subgroup", "test2"], obj=obj) |
| 344 | assert result.exit_code == 0 |
| 345 | assert result.output == "testappgroup\n" |
| 346 | |
| 347 | |
| 348 | def test_flaskgroup_app_context(runner): |
nothing calls this directly
no test coverage detected