Skip to content

Commit

Permalink
remove special cases for setuptools and wheel (#8600)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby authored Nov 1, 2023
1 parent a029b36 commit abd993c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
11 changes: 3 additions & 8 deletions src/poetry/puzzle/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,9 @@ def calculate_operations(
result_package_names = {
result_package.name for result_package, _ in self._result_packages
}
# We preserve pip/setuptools/wheel when not managed by poetry, this is
# done to avoid externally managed virtual environments causing
# unnecessary removals.
preserved_package_names = {
"pip",
"setuptools",
"wheel",
} - result_package_names
# We preserve pip when not managed by poetry, this is done to avoid
# externally managed virtual environments causing unnecessary removals.
preserved_package_names = {"pip"} - result_package_names

for installed_package in self._installed_packages:
if installed_package.name in uninstalls:
Expand Down
14 changes: 1 addition & 13 deletions tests/installation/test_installer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

import itertools
import json

from pathlib import Path
Expand Down Expand Up @@ -46,8 +45,6 @@
from tests.conftest import Config
from tests.types import FixtureDirGetter

RESERVED_PACKAGES = ("pip", "setuptools", "wheel")


class Executor(BaseExecutor):
def __init__(self, *args: Any, **kwargs: Any) -> None:
Expand Down Expand Up @@ -628,12 +625,7 @@ def test_run_install_removes_no_longer_locked_packages_if_installed(

@pytest.mark.parametrize(
"managed_reserved_package_names",
itertools.chain(
[()],
itertools.permutations(RESERVED_PACKAGES, 1),
itertools.permutations(RESERVED_PACKAGES, 2),
[RESERVED_PACKAGES],
),
[(), ("pip",)],
)
def test_run_install_with_synchronization(
managed_reserved_package_names: tuple[str, ...],
Expand All @@ -647,16 +639,12 @@ def test_run_install_with_synchronization(
package_b = get_package("b", "1.1")
package_c = get_package("c", "1.2")
package_pip = get_package("pip", "20.0.0")
package_setuptools = get_package("setuptools", "20.0.0")
package_wheel = get_package("wheel", "20.0.0")

all_packages = [
package_a,
package_b,
package_c,
package_pip,
package_setuptools,
package_wheel,
]

managed_reserved_packages = [
Expand Down

0 comments on commit abd993c

Please sign in to comment.