Home / Function/ test_app_cli_has_app_context() — flask Function Reference

test_app_cli_has_app_context() — flask Function Reference

Architecture documentation for the test_app_cli_has_app_context() function in test_cli.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  c88f4407_d4b9_9fd2_1bcd_28b44bf1b3cd["test_app_cli_has_app_context()"]
  62c63da0_a9c3_ab0a_4c48_a9413eac90e3["test_cli.py"]
  c88f4407_d4b9_9fd2_1bcd_28b44bf1b3cd -->|defined in| 62c63da0_a9c3_ab0a_4c48_a9413eac90e3
  cfcc1ba6_ce20_a6d4_f8cd_998cddafcbac["invoke()"]
  c88f4407_d4b9_9fd2_1bcd_28b44bf1b3cd -->|calls| cfcc1ba6_ce20_a6d4_f8cd_998cddafcbac
  style c88f4407_d4b9_9fd2_1bcd_28b44bf1b3cd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_cli.py lines 289–304

def test_app_cli_has_app_context(app, runner):
    def _param_cb(ctx, param, value):
        # current_app should be available in parameter callbacks
        return bool(current_app)

    @app.cli.command()
    @click.argument("value", callback=_param_cb)
    def check(value):
        app = click.get_current_context().obj.load_app()
        # the loaded app should be the same as current_app
        same_app = current_app._get_current_object() is app
        return same_app, value

    cli = FlaskGroup(create_app=lambda: app)
    result = runner.invoke(cli, ["check", "x"], standalone_mode=False)
    assert result.return_value == (True, True)

Subdomains

Defined In

Calls

Frequently Asked Questions

What does test_app_cli_has_app_context() do?
test_app_cli_has_app_context() is a function in the flask codebase, defined in tests/test_cli.py.
Where is test_app_cli_has_app_context() defined?
test_app_cli_has_app_context() is defined in tests/test_cli.py at line 289.
What does test_app_cli_has_app_context() call?
test_app_cli_has_app_context() calls 1 function(s): invoke.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free