Skip to content
Myr

Do not register empty CLI groups from Blueprint

Before adoption: this commit came in with the history the project adopted, so no landing records it.

(Fixes #3224)

authored by Daniel Pope · committed by Daniel Pope · parent 14e9291 · Browse files · 2 files+12 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+12 added−0 removed

  • tests:+9 added−0 removed
  • other:+3 added−0 removed

2 files+12 added−0 removed

modified:flask/blueprints.py+3 added
216 unmodified lines
217 deferred(state)218219 cli_resolved_group = options.get("cli_group", self.cli_group)220221 if not self.cli.commands:222 return223224 if cli_resolved_group is None:225 app.cli.commands.update(self.cli.commands)226 elif cli_resolved_group is _sentinel:227 self.cli.name = self.name
303 unmodified lines
modified:tests/test_cli.py+9 added
650 unmodified lines
651 assert "merged_result" in result.output652653 result = app_runner.invoke(args=["late_registration", "late"])654 assert "late_result" in result.output655656657def test_cli_empty(app):658 """If a Blueprint's CLI group is empty, do not register it."""659 bp = Blueprint("blue", __name__, cli_group="blue")660 app.register_blueprint(bp)661662 result = app.test_cli_runner().invoke(args=["blue", "--help"])663 assert result.exit_code == 2, "Unexpected success:\n\n" + result.output