mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-11 04:53:53 -05:00
s/QUIET/NOERROR/g
This commit is contained in:
@@ -20,9 +20,10 @@ if [ "$1" = "--complete" ]; then
|
|||||||
exec pyenv-virtualenvs --bare
|
exec pyenv-virtualenvs --bare
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unset QUIET
|
unset NOERROR
|
||||||
if [ "$1" = "--quiet" ]; then
|
|
||||||
QUIET=1
|
if [ "$1" = "--no-error" ]; then
|
||||||
|
NOERROR=1
|
||||||
shift 1
|
shift 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -46,13 +47,13 @@ if [ -z "${PYENV_VIRTUALENV_INIT}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${#versions[@]}" -gt 1 ]; then
|
if [ "${#versions[@]}" -gt 1 ]; then
|
||||||
[ -n "$QUIET" ] || echo "pyenv-virtualenv: cannot activate multiple versions at once: ${versions[@]}" 1>&2
|
[ -n "$NOERROR" ] || echo "pyenv-virtualenv: cannot activate multiple versions at once: ${versions[@]}" 1>&2
|
||||||
echo "false"
|
echo "false"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! pyenv-virtualenv-prefix "${versions}" 1>/dev/null 2>&1; then
|
if ! pyenv-virtualenv-prefix "${versions}" 1>/dev/null 2>&1; then
|
||||||
[ -n "$QUIET" ] || echo "pyenv-virtualenv: version \`${versions}' is not a virtualenv" 1>&2
|
[ -n "$NOERROR" ] || echo "pyenv-virtualenv: version \`${versions}' is not a virtualenv" 1>&2
|
||||||
echo "false"
|
echo "false"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -77,7 +78,7 @@ fish )
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
# Display setup instruction if 'pyenv virtualenv-init -' is not found in "$profile"
|
# Display setup instruction if 'pyenv virtualenv-init -' is not found in "$profile"
|
||||||
if [ -z "$QUIET" ]; then
|
if [ -z "$NOERROR" ]; then
|
||||||
if [ -f "$profile" ] && grep -q 'pyenv init -' "$profile" && ! grep -q 'pyenv virtualenv-init -' "$profile"; then
|
if [ -f "$profile" ] && grep -q 'pyenv init -' "$profile" && ! grep -q 'pyenv virtualenv-init -' "$profile"; then
|
||||||
pyenv-virtualenv-init >&2 || true
|
pyenv-virtualenv-init >&2 || true
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -9,9 +9,10 @@
|
|||||||
set -e
|
set -e
|
||||||
[ -n "$PYENV_DEBUG" ] && set -x
|
[ -n "$PYENV_DEBUG" ] && set -x
|
||||||
|
|
||||||
unset QUIET
|
unset NOERROR
|
||||||
if [ "$1" = "--quiet" ]; then
|
|
||||||
QUIET=1
|
if [ "$1" = "--no-error" ]; then
|
||||||
|
NOERROR=1
|
||||||
shift 1
|
shift 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -48,7 +49,7 @@ EOS
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -z "$QUIET" ]; then
|
if [ -z "$NOERROR" ]; then
|
||||||
echo " echo \"pyenv-virtualenv: no virtualenv has been activated.\" 1>&2;"
|
echo " echo \"pyenv-virtualenv: no virtualenv has been activated.\" 1>&2;"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -150,10 +150,10 @@ false
|
|||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "should fail if the version is not a virtualenv (quiet)" {
|
@test "should fail if the version is not a virtualenv (no-error)" {
|
||||||
stub pyenv-virtualenv-prefix "3.3.3 : false"
|
stub pyenv-virtualenv-prefix "3.3.3 : false"
|
||||||
|
|
||||||
run pyenv-sh-activate --quiet "3.3.3"
|
run pyenv-sh-activate --no-error "3.3.3"
|
||||||
|
|
||||||
unstub pyenv-virtualenv-prefix
|
unstub pyenv-virtualenv-prefix
|
||||||
|
|
||||||
@@ -173,8 +173,8 @@ false
|
|||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "should fail if there are multiple versions (quiet)" {
|
@test "should fail if there are multiple versions (no-error)" {
|
||||||
run pyenv-sh-activate --quiet "venv" "venv27"
|
run pyenv-sh-activate --no-error "venv" "venv27"
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ fi;
|
|||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "deactivate virtualenv (quiet)" {
|
@test "deactivate virtualenv (no-error)" {
|
||||||
export PYENV_VIRTUALENV_INIT=1
|
export PYENV_VIRTUALENV_INIT=1
|
||||||
|
|
||||||
PYENV_SHELL="bash" run pyenv-sh-deactivate --quiet
|
PYENV_SHELL="bash" run pyenv-sh-deactivate --no-error
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
@@ -57,10 +57,10 @@ fi;
|
|||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "deactivate virtualenv (w/o pyenv-virtualenv-init) (quiet)" {
|
@test "deactivate virtualenv (w/o pyenv-virtualenv-init) (no-error)" {
|
||||||
export PYENV_VIRTUALENV_INIT=
|
export PYENV_VIRTUALENV_INIT=
|
||||||
|
|
||||||
PYENV_SHELL="bash" run pyenv-sh-deactivate --quiet
|
PYENV_SHELL="bash" run pyenv-sh-deactivate --no-error
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
@@ -91,10 +91,10 @@ end;
|
|||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "deactivate virtualenv (fish) (quiet)" {
|
@test "deactivate virtualenv (fish) (no-error)" {
|
||||||
export PYENV_VIRTUALENV_INIT=1
|
export PYENV_VIRTUALENV_INIT=1
|
||||||
|
|
||||||
PYENV_SHELL="fish" run pyenv-sh-deactivate --quiet
|
PYENV_SHELL="fish" run pyenv-sh-deactivate --no-error
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
@@ -125,10 +125,10 @@ end;
|
|||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "deactivate virtualenv (fish) (w/o pyenv-virtualenv-init) (quiet)" {
|
@test "deactivate virtualenv (fish) (w/o pyenv-virtualenv-init) (no-error)" {
|
||||||
export PYENV_VIRTUALENV_INIT=
|
export PYENV_VIRTUALENV_INIT=
|
||||||
|
|
||||||
PYENV_SHELL="fish" run pyenv-sh-deactivate --quiet
|
PYENV_SHELL="fish" run pyenv-sh-deactivate --no-error
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
|
|||||||
Reference in New Issue
Block a user