Skip to content

Commit

Permalink
pypa#3722 Check overlapping packages between default and dev during u…
Browse files Browse the repository at this point in the history
…ninstall all-dev
  • Loading branch information
ianpittwood committed Sep 7, 2019
1 parent 098fd82 commit 3affc39
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions pipenv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2245,8 +2245,10 @@ def do_uninstall(
)
do_purge(bare=False, allow_global=system)
sys.exit(0)
overlapping_package_names = set()
if all_dev:
package_names = project_pkg_names["dev"]
overlapping_package_names = project_pkg_names["dev"] & project_pkg_names["default"]
else:
package_names = set([pkg_name for pkg_name in package_names])
selected_pkg_map = {
Expand All @@ -2264,7 +2266,7 @@ def do_uninstall(
)
)
# Uninstall the package.
if package_name in packages_to_remove:
if package_name in packages_to_remove and package_name not in overlapping_package_names:
with project.environment.activated():
if pip_path is None:
pip_path = which_pip(allow_global=system)
Expand All @@ -2286,7 +2288,7 @@ def do_uninstall(
crayons.white(fix_utf8("Pipfile.lock…")))
)
lockfile = project.get_or_create_lockfile()
if normalized in lockfile.default:
if normalized in lockfile.default and package_name not in overlapping_package_names:
del lockfile.default[normalized]
if normalized in lockfile.develop:
del lockfile.develop[normalized]
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_uninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ def test_uninstall_all_dev(PipenvInstance):
@pytest.mark.install
def test_uninstall_all_dev_leave_prod_packages(PipenvInstance):
with PipenvInstance() as p:
c = p.pipenv("install flask")
c = p.pipenv("install --dev black")
assert c.return_code == 0

c = p.pipenv("install --dev black")
c = p.pipenv("install flask")
assert c.return_code == 0

assert "flask" in p.pipfile["packages"]
Expand Down

0 comments on commit 3affc39

Please sign in to comment.