#!/usr/bin/env bats load test_helper export PYENV_ROOT="${TMP}/pyenv" setup() { stub pyenv-hooks 'install : true' stub pyenv-rehash 'true' } stub_python_build() { stub python-build "--lib : $BATS_TEST_DIRNAME/../bin/python-build --lib" "$@" stub pyenv-latest ": false" } @test "install proper" { stub_python_build 'echo python-build "$@"' run pyenv-install 3.4.2 assert_success "python-build 3.4.2 ${PYENV_ROOT}/versions/3.4.2" unstub python-build unstub pyenv-hooks unstub pyenv-rehash } @test "install proper multi versions" { #stub python-build "--lib : $BATS_TEST_DIRNAME/../bin/python-build --lib" 'echo python-build "$@"' 'echo python-build "$@"' #stub pyenv-latest ": false" ": false" stub_python_build 'echo python-build "$@"' 'echo python-build "$@"' stub pyenv-latest ": false" stub pyenv-rehash 'true' run pyenv-install 3.4.1 3.4.2 assert_success assert_output <&2 && exit 2' \ "--definitions : echo 2.6.9 2.7.9-rc1 2.7.9-rc2 3.4.2 | tr ' ' $'\\n'" run pyenv-install 2.7.9 assert_failure assert_output <&2 && exit 2' \ "--definitions : true" run pyenv-install 1.9.3 assert_failure assert_output <