Skip to content

Commit

Permalink
Fix the --system without --deploy flag bug (#6297)
Browse files Browse the repository at this point in the history
* Fix the --system without --deploy flag bug
* add news fragment
  • Loading branch information
matteius authored Oct 30, 2024
1 parent 7984148 commit 7a7b342
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 deletions.
1 change: 1 addition & 0 deletions news/6295.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix regression of ``2024.3.0`` when using the ``--system`` flag without ``--deploy`` flag.
27 changes: 14 additions & 13 deletions pipenv/routines/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,19 @@ def handle_lockfile(
style="red",
)
raise exceptions.DeployException
handle_outdated_lockfile(
project,
packages,
old_hash=old_hash,
new_hash=new_hash,
system=system,
allow_global=allow_global,
skip_lock=skip_lock,
pre=pre,
pypi_mirror=pypi_mirror,
categories=categories,
)
elif not system:
handle_outdated_lockfile(
project,
packages,
old_hash=old_hash,
new_hash=new_hash,
system=system,
allow_global=allow_global,
skip_lock=skip_lock,
pre=pre,
pypi_mirror=pypi_mirror,
categories=categories,
)
elif not project.lockfile_exists and not skip_lock:
handle_missing_lockfile(project, system, allow_global, pre, pypi_mirror)

Expand Down Expand Up @@ -305,7 +306,7 @@ def do_install(
categories=pipfile_categories,
skip_lock=skip_lock,
)
if not deploy:
if not (deploy or system):
new_packages, _ = handle_new_packages(
project,
packages,
Expand Down
16 changes: 16 additions & 0 deletions tests/integration/test_install_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,22 @@ def test_system_and_deploy_work(pipenv_instance_private_pypi):
assert c.returncode == 0



@pytest.mark.cli
@pytest.mark.deploy
@pytest.mark.system
def test_system_works(pipenv_instance_pypi):
with pipenv_instance_pypi() as p:
c = p.pipenv("install urllib3")
assert c.returncode == 0
c = p.pipenv("--rm")
assert c.returncode == 0
c = subprocess_run(["virtualenv", ".venv"])
assert c.returncode == 0
c = p.pipenv("install --system")
assert c.returncode == 0


@pytest.mark.basic
@pytest.mark.install
def test_install_creates_pipfile(pipenv_instance_pypi):
Expand Down

0 comments on commit 7a7b342

Please sign in to comment.