Skip to content

Type hint for FlaskCliRunner.invoke is not specific #5645

Closed
@loewexy

Description

@loewexy

The type hint of the return type of FlaskCliRunner.invoke ist typing.Any but should use click.testing.Result. This leads to missing auto completions in the IDE as well as errors from the type checker if not additional type narrowing is done.

The Problem is here: https://github.com/pallets/flask/blob/main/src/flask/testing.py#L276

To fix this Result must be imported from click.testing and used as a return type annotation.

The documentation already specifies click.testing.Result as return type.

Environment:

  • Python version: 3.12.2
  • Flask version: 3.1.0 but is also present in current main branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions