Skip to content

Commit

Permalink
build(deps): bump minimum craft-cli to 2.10.1
Browse files Browse the repository at this point in the history
Version 2.10.1 fixes the issue where the app greeting is shown twice when
running in managed mode, which happened because the Emitter was initialized in
"verbose" and then the Dispatcher set it to verbose again when parsing the
command line.

Fixes #551
  • Loading branch information
tigarmo committed Nov 12, 2024
1 parent f48f44a commit a84da6d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description = "A framework for *craft applications."
dynamic = ["version", "readme"]
dependencies = [
"craft-archives>=2.0.0",
"craft-cli>=2.9.0",
"craft-cli>=2.10.1",
"craft-grammar>=2.0.0",
"craft-parts>=2.1.1",
"craft-platforms>=0.3.1",
Expand Down
21 changes: 21 additions & 0 deletions tests/integration/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,3 +462,24 @@ def test_runtime_error_logging(monkeypatch, tmp_path, create_app, mocker):
# Make sure it's identified as the correct error type
parts_message = "Parts processing internal error: An unexpected error"
assert parts_message in log_contents


def test_verbosity_greeting(monkeypatch, create_app, capsys):
"""Test that 'verbose' runs only show the greeting once."""

# Set the verbosity *both* through the environment variable and the
# command line, to ensure that the greeting is only shown once even with
# multiple verbosity "settings".
monkeypatch.setenv("CRAFT_VERBOSITY_LEVEL", "verbose")
monkeypatch.setattr("sys.argv", ["testcraft", "i-dont-exist", "-v"])

app = create_app()
with pytest.raises(SystemExit):
app.run()

_, err = capsys.readouterr()
lines = err.splitlines()
greetings = [line for line in lines if line.startswith("Starting testcraft")]

# Exactly one greeting
assert len(greetings) == 1

0 comments on commit a84da6d

Please sign in to comment.