Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: no message when no packages upgraded with upgrade-all #1597

Merged
merged 3 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/1565.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix no message displayed when no packages are upgraded with `upgrade-all`.
6 changes: 3 additions & 3 deletions src/pipx/commands/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def upgrade_all(
if venv_dir.name in skip or "--editable" in venv.pipx_metadata.main_package.pip_args:
continue
try:
_upgrade_venv(
versions_updated = _upgrade_venv(
venv_dir,
venv.pipx_metadata.main_package.pip_args,
verbose=verbose,
Expand All @@ -256,11 +256,11 @@ def upgrade_all(
force=force,
python_flag_passed=python_flag_passed,
)
if versions_updated > 0:
upgraded.append(venv_dir.name)
except PipxError as e:
print(e, file=sys.stderr)
failed.append(venv_dir.name)
else:
upgraded.append(venv_dir.name)
if len(upgraded) == 0:
print(f"No packages upgraded after running 'pipx upgrade-all' {sleep}")
if len(failed) > 0:
Expand Down
1 change: 1 addition & 0 deletions tests/test_upgrade_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def test_upgrade_all(pipx_temp_env, capsys):


def test_upgrade_all_none(pipx_temp_env, capsys):
assert not run_pipx_cli(["install", "pycowsay"])
assert not run_pipx_cli(["upgrade-all"])
captured = capsys.readouterr()
assert "No packages upgraded after running 'pipx upgrade-all'" in captured.out
Expand Down