diff --git a/src/pdm/cli/commands/list.py b/src/pdm/cli/commands/list.py index 19fbef8c35..7fd3556a75 100644 --- a/src/pdm/cli/commands/list.py +++ b/src/pdm/cli/commands/list.py @@ -234,7 +234,7 @@ def _group_of(name: str) -> set[str]: keys = parse_comma_separated_string(options.sort) if not all(key in Listable.KEYS for key in keys): raise PdmUsageError(f"--sort key must be one of: {','.join(Listable.KEYS)}") - records.sort(key=lambda d: tuple(d[key] for key in keys)) + records.sort(key=lambda d: tuple(d[key].lower() for key in keys)) # Write CSV if options.csv: diff --git a/tests/cli/test_list.py b/tests/cli/test_list.py index c0978df067..1c2fba5f86 100644 --- a/tests/cli/test_list.py +++ b/tests/cli/test_list.py @@ -430,7 +430,7 @@ def test_list_bare(project, pdm): @mock.patch("pdm.termui.ROUNDED", ASCII) @pytest.mark.usefixtures("working_set") def test_list_bare_sorted_name(project, pdm): - pdm(["add", "requests"], obj=project, strict=True) + pdm(["add", "requests", "pyyaml"], obj=project, strict=True) result = pdm(["list", "--sort", "name"], obj=project) expected = ( "+--------------------------------------+\n" @@ -439,6 +439,7 @@ def test_list_bare_sorted_name(project, pdm): "| certifi | 2018.11.17 | |\n" "| chardet | 3.0.4 | |\n" "| idna | 2.7 | |\n" + "| PyYAML | 6.0 | |\n" "| requests | 2.19.1 | |\n" "| test-project | 0.0.0 | |\n" "| urllib3 | 1.22 | |\n" diff --git a/tests/fixtures/pypi.json b/tests/fixtures/pypi.json index 1c472b4402..f7b899970e 100644 --- a/tests/fixtures/pypi.json +++ b/tests/fixtures/pypi.json @@ -60,5 +60,6 @@ "1.0": { "dependencies": ["django<2"] } - } + }, + "PyYAML": { "6.0": {} } }