Skip to content

Commit

Permalink
Merge branch 'master' into fix/skip-pre-commit-hook
Browse files Browse the repository at this point in the history
  • Loading branch information
bentocin authored Jul 19, 2023
2 parents 1d59e32 + cdc7aa4 commit 085634c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
13 changes: 9 additions & 4 deletions src/poetry/installation/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,13 +461,18 @@ def get_operation_message(
)

if isinstance(operation, Update):
initial_version = (initial_pkg := operation.initial_package).version
target_version = (target_pkg := operation.target_package).version
update_kind = (
"Updating" if target_version >= initial_version else "Downgrading"
)
return (
f"<{base_tag}>Updating"
f" <{package_color}>{operation.initial_package.name}</{package_color}> "
f"<{base_tag}>{update_kind}"
f" <{package_color}>{initial_pkg.name}</{package_color}> "
f"(<{source_operation_color}>"
f"{operation.initial_package.full_pretty_version}"
f"{initial_pkg.full_pretty_version}"
f"</{source_operation_color}> -> <{operation_color}>"
f"{operation.target_package.full_pretty_version}</>)</>"
f"{target_pkg.full_pretty_version}</>)</>"
)
return ""

Expand Down
10 changes: 6 additions & 4 deletions tests/installation/test_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ def test_execute_executes_a_batch_of_operations(
Install(Package("pytest", "3.5.1")),
Uninstall(Package("attrs", "17.4.0")),
Update(Package("requests", "2.18.3"), Package("requests", "2.18.4")),
Update(Package("pytest", "3.5.1"), Package("pytest", "3.5.0")),
Uninstall(Package("clikit", "0.2.3")).skip("Not currently installed"),
Install(file_package),
Install(directory_package),
Expand All @@ -254,11 +255,12 @@ def test_execute_executes_a_batch_of_operations(
)

expected = f"""
Package operations: 4 installs, 1 update, 1 removal
Package operations: 4 installs, 2 updates, 1 removal
• Installing pytest (3.5.1)
• Removing attrs (17.4.0)
• Updating requests (2.18.3 -> 2.18.4)
• Downgrading pytest (3.5.1 -> 3.5.0)
• Installing demo (0.1.0 {file_package.source_url})
• Installing simple-project (1.2.3 {directory_package.source_url})
• Installing demo (0.1.0 master)
Expand All @@ -267,9 +269,9 @@ def test_execute_executes_a_batch_of_operations(
expected_lines = set(expected.splitlines())
output_lines = set(io.fetch_output().splitlines())
assert output_lines == expected_lines
assert wheel_install.call_count == 5
# Two pip uninstalls: one for the remove operation one for the update operation
assert len(env.executed) == 2
assert wheel_install.call_count == 6
# 3 pip uninstalls: one for the remove operation and two for the update operations
assert len(env.executed) == 3
assert return_code == 0

assert prepare_spy.call_count == 2
Expand Down

0 comments on commit 085634c

Please sign in to comment.