mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-08 03:23:54 -05:00
Support a prefix resolved by pyenv-latest as base version (#446)
This commit is contained in:
@@ -310,6 +310,10 @@ else
|
||||
VIRTUALENV_NAME="${ARGUMENTS[1]}"
|
||||
fi
|
||||
|
||||
if [[ -n "${VERSION_NAME}" ]] && command -v pyenv-latest >/dev/null; then
|
||||
VERSION_NAME="$(pyenv-latest -q "${VERSION_NAME}" || echo "${VERSION_NAME}")"
|
||||
fi
|
||||
|
||||
if [ -z "${VERSION_NAME}" ] || [ -z "${VIRTUALENV_NAME}" ]; then
|
||||
usage 1
|
||||
fi
|
||||
|
||||
@@ -50,6 +50,35 @@ OUT
|
||||
unstub curl
|
||||
}
|
||||
|
||||
@test "create virtualenv from a given prefix" {
|
||||
stub_pyenv "2.7.11"
|
||||
stub pyenv-virtualenv-prefix " : false"
|
||||
stub pyenv-exec "python2.7 -m venv --help : false"
|
||||
stub pyenv-exec "python2 -m venv --help : false"
|
||||
stub pyenv-exec "python -m venv --help : false"
|
||||
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
|
||||
stub pyenv-latest "-q 2.7 : echo 2.7.11"
|
||||
|
||||
run pyenv-virtualenv "2.7" "venv"
|
||||
|
||||
assert_output <<OUT
|
||||
PYENV_VERSION=2.7.11 virtualenv ${PYENV_ROOT}/versions/2.7.11/envs/venv
|
||||
Installing pip from https://bootstrap.pypa.io/pip/2.7/get-pip.py...
|
||||
rehashed
|
||||
OUT
|
||||
assert [ -x "${PYENV_ROOT}/versions/2.7.11/envs/venv/bin/pydoc" ]
|
||||
assert [ ! -e "${PYENV_ROOT}/versions/2.7" ]
|
||||
assert_success
|
||||
|
||||
unstub_pyenv
|
||||
unstub pyenv-virtualenv-prefix
|
||||
unstub pyenv-exec
|
||||
unstub curl
|
||||
}
|
||||
|
||||
@test "create virtualenv from current version" {
|
||||
export PYENV_VERSION="2.7.11"
|
||||
stub_pyenv "${PYENV_VERSION}"
|
||||
|
||||
Reference in New Issue
Block a user