(app, runner)
| 287 | |
| 288 | |
| 289 | def test_app_cli_has_app_context(app, runner): |
| 290 | def _param_cb(ctx, param, value): |
| 291 | # current_app should be available in parameter callbacks |
| 292 | return bool(current_app) |
| 293 | |
| 294 | @app.cli.command() |
| 295 | @click.argument("value", callback=_param_cb) |
| 296 | def check(value): |
| 297 | app = click.get_current_context().obj.load_app() |
| 298 | # the loaded app should be the same as current_app |
| 299 | same_app = current_app._get_current_object() is app |
| 300 | return same_app, value |
| 301 | |
| 302 | cli = FlaskGroup(create_app=lambda: app) |
| 303 | result = runner.invoke(cli, ["check", "x"], standalone_mode=False) |
| 304 | assert result.return_value == (True, True) |
| 305 | |
| 306 | |
| 307 | def test_with_appcontext(runner): |
nothing calls this directly
no test coverage detected