Commit 8321a8ff by Sébastien Eustace Committed by GitHub

Fix an error in show when using the -o option (#1607)

parent e0156477
...@@ -172,6 +172,13 @@ lists all packages available.""" ...@@ -172,6 +172,13 @@ lists all packages available."""
# Non installed in non decorated mode # Non installed in non decorated mode
install_marker = " (!)" install_marker = " (!)"
if (
show_latest
and self.option("outdated")
and latest_statuses[locked.pretty_name] == "up-to-date"
):
continue
line = "<fg={}>{:{}}{}</>".format( line = "<fg={}>{:{}}{}</>".format(
color, name, name_length - len(install_marker), install_marker color, name, name_length - len(install_marker), install_marker
) )
...@@ -183,9 +190,6 @@ lists all packages available.""" ...@@ -183,9 +190,6 @@ lists all packages available."""
latest = latest_packages[locked.pretty_name] latest = latest_packages[locked.pretty_name]
update_status = latest_statuses[locked.pretty_name] update_status = latest_statuses[locked.pretty_name]
if self.option("outdated") and update_status == "up-to-date":
continue
if write_latest: if write_latest:
color = "green" color = "green"
if update_status == "semver-safe-update": if update_status == "semver-safe-update":
......
...@@ -379,6 +379,46 @@ cachy 0.1.0 0.2.0 Cachy package ...@@ -379,6 +379,46 @@ cachy 0.1.0 0.2.0 Cachy package
assert expected == tester.io.fetch_output() assert expected == tester.io.fetch_output()
def test_show_outdated_with_only_up_to_date_packages(app, poetry, installed, repo):
command = app.find("show")
tester = CommandTester(command)
cachy_020 = get_package("cachy", "0.2.0")
cachy_020.description = "Cachy package"
installed.add_package(cachy_020)
repo.add_package(cachy_020)
poetry.locker.mock_lock_data(
{
"package": [
{
"name": "cachy",
"version": "0.2.0",
"description": "Cachy package",
"category": "main",
"optional": False,
"platform": "*",
"python-versions": "*",
"checksum": [],
},
],
"metadata": {
"python-versions": "*",
"platform": "*",
"content-hash": "123456789",
"hashes": {"cachy": []},
},
}
)
tester.execute("--outdated")
expected = ""
assert expected == tester.io.fetch_output()
def test_show_outdated_has_prerelease_but_not_allowed(app, poetry, installed, repo): def test_show_outdated_has_prerelease_but_not_allowed(app, poetry, installed, repo):
command = app.find("show") command = app.find("show")
tester = CommandTester(command) tester = CommandTester(command)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment