Skip to content

Commit e6e7c12

Browse files
Mr-Pepeuranusjr
andauthored
Disallow freeze format with pip list --outdated (#11482)
Co-authored-by: Tzu-ping Chung <[email protected]>
1 parent 2c89928 commit e6e7c12

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

news/9789.removal.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove the ability to use ``pip list --outdated`` in combination with ``--format=freeze``.

src/pip/_internal/commands/list.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ def run(self, options: Values, args: List[str]) -> int:
155155
if options.outdated and options.uptodate:
156156
raise CommandError("Options --outdated and --uptodate cannot be combined.")
157157

158+
if options.outdated and options.list_format == "freeze":
159+
raise CommandError(
160+
"List format 'freeze' can not be used with the --outdated option."
161+
)
162+
158163
cmdoptions.check_list_path_option(options)
159164

160165
skip = set(stdlib_pkgs)

tests/functional/test_list.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,16 +577,20 @@ def test_outdated_formats(script: PipTestEnvironment, data: TestData) -> None:
577577
assert "Package Version Latest Type" in result.stdout
578578
assert "simple 1.0 1.1 wheel" in result.stdout
579579

580-
# Check freeze
580+
# Check that freeze is not allowed
581581
result = script.pip(
582582
"list",
583583
"--no-index",
584584
"--find-links",
585585
wheelhouse_path,
586586
"--outdated",
587587
"--format=freeze",
588+
expect_error=True,
589+
)
590+
assert (
591+
"List format 'freeze' can not be used with the --outdated option."
592+
in result.stderr
588593
)
589-
assert "simple==1.0" in result.stdout
590594

591595
# Check json
592596
result = script.pip(

0 commit comments

Comments
 (0)