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

Disallow freeze format with pip list --outdated #11482

Merged
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 news/9789.removal.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove the ability to use ``pip list --outdated`` in combination with ``--format=freeze``.
5 changes: 5 additions & 0 deletions src/pip/_internal/commands/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ def run(self, options: Values, args: List[str]) -> int:
if options.outdated and options.uptodate:
raise CommandError("Options --outdated and --uptodate cannot be combined.")

if options.outdated and options.list_format == "freeze":
raise CommandError(
"List format 'freeze' can not be used with the --outdated option."
)

cmdoptions.check_list_path_option(options)

skip = set(stdlib_pkgs)
Expand Down
8 changes: 6 additions & 2 deletions tests/functional/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,16 +577,20 @@ def test_outdated_formats(script: PipTestEnvironment, data: TestData) -> None:
assert "Package Version Latest Type" in result.stdout
assert "simple 1.0 1.1 wheel" in result.stdout

# Check freeze
# Check that freeze is not allowed
result = script.pip(
"list",
"--no-index",
"--find-links",
wheelhouse_path,
"--outdated",
"--format=freeze",
expect_error=True,
)
assert (
"List format 'freeze' can not be used with the --outdated option."
in result.stderr
)
assert "simple==1.0" in result.stdout

# Check json
result = script.pip(
Expand Down