#!/usr/bin/env bats load test_helper # Make the build deterministic: `pyenv-install' just creates the prefix, and # the platform tools report a fixed Linux target so the real `save' and # `generate-installer' behave the same on any test host. stub_build_environment() { create_stub pyenv-install 'echo "${0##*/} $*"; mkdir -p "${PYENV_ROOT}/versions/${1##*:}/bin"' create_stub pyenv-latest 'while (($#)); do case "$1" in -f|-k);; *)break;; esac; shift; done; echo "$*"' create_stub uname 'case "$1" in -s) echo Linux;; -m) echo x86_64;; esac' create_stub getconf 'echo "glibc 2.17"' create_stub readelf true } @test "-v|--verbose runs pyenv install verbosely" { stub_build_environment create_stub pyenv-binary-save true create_stub pyenv-binary-generate-installer true for opt in "" -v --verbose; do run pyenv-binary-package $opt 3.12.7:3.12.7-test \ --archive-base-url http://example.com/binaries assert_success "pyenv-install ${opt:+--verbose }3.12.7:3.12.7-test" done } @test "completions" { create_stub pyenv-install 'echo "${0##*/} $*"' run pyenv-binary-package --complete assert_success <