Home / Function/ invoke() — flask Function Reference

invoke() — flask Function Reference

Architecture documentation for the invoke() function in testing.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  afe2d4ce_87b9_7239_bb5b_c8fe6ec46b0d["invoke()"]
  f9a6411b_4c7f_0b0b_2695_fd4e74ed8af8["FlaskCliRunner"]
  afe2d4ce_87b9_7239_bb5b_c8fe6ec46b0d -->|defined in| f9a6411b_4c7f_0b0b_2695_fd4e74ed8af8
  style afe2d4ce_87b9_7239_bb5b_c8fe6ec46b0d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

src/flask/testing.py lines 275–298

    def invoke(  # type: ignore
        self, cli: t.Any = None, args: t.Any = None, **kwargs: t.Any
    ) -> Result:
        """Invokes a CLI command in an isolated environment. See
        :meth:`CliRunner.invoke <click.testing.CliRunner.invoke>` for
        full method documentation. See :ref:`testing-cli` for examples.

        If the ``obj`` argument is not given, passes an instance of
        :class:`~flask.cli.ScriptInfo` that knows how to load the Flask
        app being tested.

        :param cli: Command object to invoke. Default is the app's
            :attr:`~flask.app.Flask.cli` group.
        :param args: List of strings to invoke the command with.

        :return: a :class:`~click.testing.Result` object.
        """
        if cli is None:
            cli = self.app.cli

        if "obj" not in kwargs:
            kwargs["obj"] = ScriptInfo(create_app=lambda: self.app)

        return super().invoke(cli, args, **kwargs)

Subdomains

Frequently Asked Questions

What does invoke() do?
invoke() is a function in the flask codebase, defined in src/flask/testing.py.
Where is invoke() defined?
invoke() is defined in src/flask/testing.py at line 275.

Analyze Your Own Codebase

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

Try Supermodel Free