diff --git a/libexec/pyenv-latest b/libexec/pyenv-latest index 4cbb4136..01c667d0 100755 --- a/libexec/pyenv-latest +++ b/libexec/pyenv-latest @@ -49,7 +49,7 @@ IFS=$'\n' fi DEFINITION_CANDIDATES=( $(pyenv-versions --bare --skip-envs) ) else - DEFINITION_CANDIDATES=( $(python-build --definitions ) ) + DEFINITION_CANDIDATES=( $(pyenv-install --list --bare) ) fi # Avoid `grep -q' to prevent SIGPIPE that would fail the check with pipefail diff --git a/plugins/python-build/bin/pyenv-install b/plugins/python-build/bin/pyenv-install index 2fd268fd..feb0a983 100755 --- a/plugins/python-build/bin/pyenv-install +++ b/plugins/python-build/bin/pyenv-install @@ -126,7 +126,7 @@ done if [[ -n $LIST ]]; then if [[ -n $BARE ]]; then - definitions + exec python-build --definitions else echo "Available versions:" definitions | indent diff --git a/plugins/python-build/test/pyenv.bats b/plugins/python-build/test/pyenv.bats index 12d7d2de..47f1581c 100644 --- a/plugins/python-build/test/pyenv.bats +++ b/plugins/python-build/test/pyenv.bats @@ -176,6 +176,15 @@ OUT unstub python-build } +@test "bare listing fails when definition listing fails" { + stub_python_build_lib '--definitions : echo "listing failed" >&2; exit 1' + + run pyenv-install --list --bare + assert_failure "listing failed" + + unstub python-build +} + @test "upgrade instructions given for a nonexistent version" { stub brew false stub_python_build_lib diff --git a/test/latest.bats b/test/latest.bats index 6ed817b8..d1fcfd09 100644 --- a/test/latest.bats +++ b/test/latest.bats @@ -14,7 +14,7 @@ echo 4.5.6 } @test "read from known" { - create_stub python-build <&2; exit 1' + + run pyenv-latest -f -k 3.14 + assert_failure "listing failed" +} + @test "complete name resolves to itself" { create_stub pyenv-versions <