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.
Attributes
| Attribute | Type | Description |
|---|---|---|
| app | [Flask](../app/flask.md?sid=src_flask_app_flask) | The Flask application instance that this runner is configured to test against. |
Constructor
Signature
def FlaskCliRunner(
app: [Flask](../app/flask.md?sid=src_flask_app_flask),
**kwargs: t.Any
) - > None
Parameters
| Name | Type | Description |
|---|---|---|
| app | [Flask](../app/flask.md?sid=src_flask_app_flask) | The Flask application instance to be tested. |
| **kwargs | t.Any | Additional keyword arguments passed to the click.testing.CliRunner constructor. |
Signature
def FlaskCliRunner(
app: [Flask](../app/flask.md?sid=src_flask_app_flask),
**kwargs: t.Any
) - > null
Parameters
| Name | Type | Description |
|---|---|---|
| app | [Flask](../app/flask.md?sid=src_flask_app_flask) | The Flask application instance to be tested via the CLI runner |
| **kwargs | t.Any | Additional keyword arguments passed to the underlying click.testing.CliRunner constructor |
Methods
invoke()
@classmethod
def invoke(
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.
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. |
| **kwargs | t.Any | Additional arguments passed to the underlying Click runner, such as 'input', 'env', or 'obj' |
Returns
| Type | Description |
|---|---|
Result | a :class:~click.testing.Result object. |