FlaskCliRunner
A :class:~click.testing.CliRunner for testing a Flask app's CLI commands. Typically created using :meth:~flask.Flask.test_cli_runner. See :ref:testing-cli.
Constructor
Signature
def FlaskCliRunner(
app: [Flask](../app/flask.md?sid=flask_app_flask),
**kwargs: t.Any
) - > None
Parameters
| Name | Type | Description |
|---|---|---|
| app | [Flask](../app/flask.md?sid=flask_app_flask) | The Flask application instance. |
| **kwargs | t.Any | Additional keyword arguments passed to the CliRunner parent constructor. |
Methods
invoke()
@classmethod
def invoke(
cli: t.Any = None,
args: t.Any = None
) - > 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.
Parameters
| Name | Type | Description |
|---|---|---|
| cli | t.Any = None | Command object to invoke. Default is the app's |
:attr:~flask.app.Flask.cli group. | ||
| args | t.Any = None | List of strings to invoke the command with. |
Returns
| Type | Description |
|---|---|
Result | a :class:~click.testing.Result object. |