Skip to content
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

Fix the --system without --deploy flag bug #6297

Merged
merged 4 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading