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 install failures that silently pass #5046

Merged
merged 11 commits into from
Apr 21, 2022
1 change: 1 addition & 0 deletions news/5031.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixes case where packages could fail to install and the exit code was successful.
30 changes: 17 additions & 13 deletions pipenv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,9 @@ def batch_install(
]
sequential_dep_names = [d.name for d in sequential_deps]

deps_list_bar = progress.bar(deps_to_install, width=32, label=label)
deps_list_bar = progress.bar(
deps_to_install, width=32, label=label, hide=environments.PIPENV_IS_CI
)

trusted_hosts = []
# Install these because
Expand Down Expand Up @@ -871,18 +873,6 @@ def do_install_dependencies(
if not procs.empty():
_cleanup_procs(project, procs, failed_deps_queue)

# click.echo(crayons.normal(
# decode_for_output("Installing editable and vcs dependencies..."), bold=True
# ))

# install_kwargs.update({"blocking": True})
# # XXX: All failed and editable/vcs deps should be installed in sequential mode!
# procs = queue.Queue(maxsize=1)
# batch_install(
# editable_or_vcs_deps, procs, failed_deps_queue, requirements_dir,
# **install_kwargs
# )

# Iterate over the hopefully-poorly-packaged dependencies...
if not failed_deps_queue.empty():
click.echo(
Expand All @@ -905,6 +895,20 @@ def do_install_dependencies(
)
if not procs.empty():
_cleanup_procs(project, procs, failed_deps_queue, retry=False)
if not failed_deps_queue.empty():
failed_list = []
while not failed_deps_queue.empty():
failed_dep = failed_deps_queue.get()
failed_list.append(failed_dep)
click.echo(
click.style(
f"Failed to install some dependency or packages. "
f"The following have failed installation and attempted retry: {failed_list}",
fg="red",
),
err=True,
)
sys.exit(1)


def convert_three_to_python(three, python):
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/test_install_uri.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def test_local_vcs_urls_work(PipenvInstance, tmpdir):
@pytest.mark.urls
@pytest.mark.install
@pytest.mark.needs_internet
@pytest.mark.skip_windows # FIXME: https://github.com/pypa/pipenv/issues/5064
def test_editable_vcs_install(PipenvInstance_NoPyPI):
with PipenvInstance_NoPyPI(chdir=True) as p:
c = p.pipenv(
Expand All @@ -146,6 +147,7 @@ def test_editable_vcs_install(PipenvInstance_NoPyPI):
@pytest.mark.urls
@pytest.mark.install
@pytest.mark.needs_internet
@pytest.mark.skip_windows # FIXME: https://github.com/pypa/pipenv/issues/5064
def test_install_editable_git_tag(PipenvInstance_NoPyPI):
# This uses the real PyPI since we need Internet to access the Git
# dependency anyway.
Expand Down Expand Up @@ -240,6 +242,7 @@ def test_install_local_vcs_not_in_lockfile(PipenvInstance):
@pytest.mark.urls
@pytest.mark.install
@pytest.mark.needs_internet
@pytest.mark.skip_windows # FIXME: https://github.com/pypa/pipenv/issues/5064
def test_get_vcs_refs(PipenvInstance_NoPyPI):
with PipenvInstance_NoPyPI(chdir=True) as p:
c = p.pipenv(
Expand Down