mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-10 12:33:54 -05:00
Exit as error on activation failures
This commit is contained in:
@@ -41,10 +41,14 @@ fi
|
||||
|
||||
if [ "${#versions[@]}" -gt 1 ]; then
|
||||
echo "pyenv-virtualenv: cannot activate multiple versions at once: ${versions[@]}" 1>&2
|
||||
echo "false"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pyenv-virtualenv-prefix "${versions}" 1>/dev/null
|
||||
if ! pyenv-virtualenv-prefix "${versions}" 1>/dev/null; then
|
||||
echo "false"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
shell="$(basename "${PYENV_SHELL:-$SHELL}")"
|
||||
case "$shell" in
|
||||
|
||||
@@ -137,13 +137,17 @@ EOS
|
||||
}
|
||||
|
||||
@test "should fail if the version is not a virtualenv" {
|
||||
stub pyenv-virtualenv-prefix "3.3.3 : false"
|
||||
stub pyenv-virtualenv-prefix "3.3.3 : echo \"not a virtualenv\" 1>&2; false"
|
||||
|
||||
run pyenv-sh-activate "3.3.3"
|
||||
|
||||
unstub pyenv-virtualenv-prefix
|
||||
|
||||
assert_failure
|
||||
assert_output <<EOS
|
||||
not a virtualenv
|
||||
false
|
||||
EOS
|
||||
}
|
||||
|
||||
@test "should fail if there are multiple versions" {
|
||||
@@ -152,6 +156,7 @@ EOS
|
||||
assert_failure
|
||||
assert_output <<EOS
|
||||
pyenv-virtualenv: cannot activate multiple versions at once: venv venv27
|
||||
false
|
||||
EOS
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user