-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Don't exclude setuptools, distribute & wheel from freeze output on Python 3.12+ #12032
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
``freeze`` no longer excludes the ``setuptools``, ``distribute``, and ``wheel`` | ||
from the output when running on Python 3.12 or later, where they are not | ||
included in a virtual environment by default. Use ``--exclude`` if you wish to | ||
exclude any of these packages. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,11 +88,49 @@ def test_basic_freeze(script: PipTestEnvironment) -> None: | |
|
||
|
||
def test_freeze_with_pip(script: PipTestEnvironment) -> None: | ||
"""Test pip shows itself""" | ||
"""Test that pip shows itself only when --all is used""" | ||
result = script.pip("freeze") | ||
assert "pip==" not in result.stdout | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This also doesn't seem directly related to this PR. It's a sensible addition, but why is it included here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just making sure that pip is still hidden by default. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A comment mentioning pip should hide itself from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't the test docstring say exactly that? |
||
result = script.pip("freeze", "--all") | ||
assert "pip==" in result.stdout | ||
|
||
|
||
def test_freeze_with_setuptools(script: PipTestEnvironment) -> None: | ||
""" | ||
Test that pip shows setuptools only when --all is used | ||
or _should_suppress_build_backends() returns false | ||
""" | ||
|
||
result = script.pip("freeze", "--all") | ||
assert "setuptools==" in result.stdout | ||
|
||
(script.site_packages_path / "mock.pth").write_text("import mock\n") | ||
|
||
(script.site_packages_path / "mock.py").write_text( | ||
textwrap.dedent( | ||
"""\ | ||
import pip._internal.commands.freeze as freeze | ||
freeze._should_suppress_build_backends = lambda: False | ||
""" | ||
) | ||
) | ||
|
||
result = script.pip("freeze") | ||
assert "setuptools==" in result.stdout | ||
|
||
(script.site_packages_path / "mock.py").write_text( | ||
textwrap.dedent( | ||
"""\ | ||
import pip._internal.commands.freeze as freeze | ||
freeze._should_suppress_build_backends = lambda: True | ||
""" | ||
) | ||
) | ||
|
||
result = script.pip("freeze") | ||
assert "setuptools==" not in result.stdout | ||
|
||
|
||
def test_exclude_and_normalization(script: PipTestEnvironment, tmpdir: Path) -> None: | ||
req_path = wheel.make_wheel(name="Normalizable_Name", version="1.0").save_to_dir( | ||
tmpdir | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a minor note, it’d be a good idea to add some sorting here so the order package appear is more stable. But honestly nobody cares that much about these help messages anyway so it’s fine to keep things as-is.