mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-14 06:23:52 -05:00
Fix virtualenv-prefix when the version is system
This commit is contained in:
@@ -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\""
|
||||
|
||||
Reference in New Issue
Block a user