mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2026-09-13 08:46:21 -04:00
Fix virtualenv-prefix when the version is system
This commit is contained in:
parent
d4ce853e94
commit
be18fd294e
|
|
@ -32,6 +32,10 @@ base_prefix() { # pyvenv
|
|||
|
||||
VIRTUALENV_PREFIX_PATHS=()
|
||||
for version in "${versions[@]}"; do
|
||||
if [ "$version" = "system" ]; then
|
||||
echo "pyenv-virtualenv: version \`${version}' is not a virtualenv" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
PREFIX="$(pyenv-prefix "${version}")"
|
||||
if [ -f "${PREFIX}/bin/activate" ]; then
|
||||
VIRTUALENV_PREFIX_PATH="$(real_prefix "${version}" || base_prefix "${version}" || true)"
|
||||
|
|
|
|||
|
|
@ -102,6 +102,19 @@ ${PYENV_ROOT}/versions/3.3.3:${PYENV_ROOT}/versions/3.4.0
|
|||
OUT
|
||||
}
|
||||
|
||||
@test "should fail if the version is the system" {
|
||||
stub pyenv-version-name "echo system"
|
||||
|
||||
PYENV_VERSION="system" run pyenv-virtualenv-prefix
|
||||
|
||||
unstub pyenv-version-name
|
||||
|
||||
assert_failure
|
||||
assert_output <<OUT
|
||||
pyenv-virtualenv: version \`system' is not a virtualenv
|
||||
OUT
|
||||
}
|
||||
|
||||
@test "should fail if the version is not a virtualenv" {
|
||||
stub pyenv-version-name "echo 3.4.0"
|
||||
stub pyenv-prefix "3.4.0 : echo \"${PYENV_ROOT}/versions/3.4.0\""
|
||||
|
|
|
|||
Loading…
Reference in a new issue