Skip to content

[self-tests] test_cli_blueprints fail with click 8.4.0 #465

@stanislavlevin

Description

@stanislavlevin

test_cli_blueprints started to fail with click 8.4.0:

―――――――――――――――――――――――――――――――――――――――――――――――― test_cli_blueprints[cli_group2-args2] ―――――――――――――――――――――――――――――――――――――――――――――――――

cli_group = Ellipsis, args = ['blueprint', 'cmd']

    @pytest.mark.parametrize(
        "cli_group, args",
        [
            ("named", ["named", "cmd"]),
            (None, ["cmd"]),
            (Ellipsis, ["blueprint", "cmd"]),
        ],
    )
    def test_cli_blueprints(cli_group: str | None, args: list[str]) -> None:
        app = Quart(__name__)
    
        blueprint = Blueprint("blueprint", __name__, cli_group=cli_group)
    
        @blueprint.cli.command("cmd")
        def command() -> None:
            click.echo("command")
    
        app.register_blueprint(blueprint)
    
        app_runner = app.test_cli_runner()
        result = app_runner.invoke(args=args)
    
>       assert "command" in result.output
E       assert 'command' in ''
E        +  where '' = <Result TypeError("object of type 'ellipsis' has no len()")>.output

app        = <Quart 'test_blueprints'>
app_runner = <quart.testing.QuartCliRunner object at 0x7fe40db1f4d0>
args       = ['blueprint', 'cmd']
blueprint  = <Blueprint 'blueprint'>
cli_group  = Ellipsis
command    = <Command cmd>
result     = <Result TypeError("object of type 'ellipsis' has no len()")>

This test seems incorrect because Blueprint hints cli_group as:
https://github.com/pallets/flask/blob/954f5684e4841aad84a8eec7ace7b81a0d3f6831/src/flask/sansio/blueprints.py#L185

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions