Skip to content

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

Closed

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

Activity

  1. EmmanuelNiyonshuti commented on Jul 1, 2026

    @EmmanuelNiyonshuti

    I ran into this same problem while bumping Quart dependencies here. To me, the issue seems to have existed before but pallets/click#3228 turned it into a hard crash. I fixed it by using flask.sansio.scaffold._sentinel in that test instead of Ellipsis!

  2. pgjones commented on Jul 23, 2026

    @pgjones
    Member

    I can't reproduce this, is it still an issue?

  3. EmmanuelNiyonshuti commented on Jul 23, 2026

    @EmmanuelNiyonshuti

    I think you would have to bump click>=8.4.0 to reproduce.

  4. musicinmybrain commented on Jul 23, 2026

    @musicinmybrain

    I can't reproduce this, is it still an issue?

    Yes, this is still straightforward to reproduce.

    $ git clone https://github.com/pallets/quart.git
    $ cd quart
    $ uv venv
    $ . .venv/bin/activate
    (quart) $ uv pip install -e .
    (quart) $ uv pip install --group tests
    […]
    ================================================================================== short test summary info ==================================================================================
    FAILED tests/test_blueprints.py::test_cli_blueprints[cli_group2-args2] - assert 'command' in ''
    
    Results (4.22s):
         253 passed
           1 failed
             - tests/test_blueprints.py:150 test_cli_blueprints[cli_group2-args2]
    
  5. mgorny commented on Aug 20, 2026

    @mgorny
    Contributor

    Still broken as of 0.22.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions