#!/usr/bin/env bats load test_helper setup() { export PYENV_ROOT="${TMP}/pyenv" } stub_pyenv() { create_executable "${PYENV_VERSION}" "virtualenv" remove_executable "${PYENV_VERSION}" "pyvenv" stub pyenv-prefix "echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'" stub pyenv-prefix "echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'" stub pyenv-prefix "echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'" stub pyenv-prefix "echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'" stub pyenv-hooks "virtualenv : echo" stub pyenv-rehash " : echo rehashed" } unstub_pyenv() { unstub pyenv-prefix unstub pyenv-hooks unstub pyenv-rehash } @test "create virtualenv from given version" { export PYENV_VERSION="3.2.1" stub_pyenv "${PYENV_VERSION}" stub pyenv-exec "virtualenv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\"" stub pyenv-exec "python -s -m ensurepip : false" stub pyenv-exec "python -s */get-pip.py : true" stub curl true run pyenv-virtualenv "3.2.1" "venv" assert_success assert_output <