Add test for /bin/python case

This commit is contained in:
Yamashita, Yuu 2016-08-01 00:19:04 +00:00
parent 4df7cf2dd6
commit 5c83c4abb7
2 changed files with 10 additions and 1 deletions

View file

@ -24,6 +24,15 @@ load test_helper
assert_success "$PYENV_TEST_DIR"
}
@test "prefix for system in /" {
mkdir -p "${PYENV_TEST_DIR}/bin"
touch "${PYENV_TEST_DIR}/bin/pyenv-which"
echo "echo /bin/python" >"${PYENV_TEST_DIR}/bin/pyenv-which"
chmod +x "${PYENV_TEST_DIR}/bin/pyenv-which"
PYENV_VERSION="system" run pyenv-prefix
assert_success "/"
}
@test "prefix for invalid system" {
PATH="$(path_without python)" run pyenv-prefix system
assert_failure "pyenv: system version not found in PATH"

View file

@ -20,10 +20,10 @@ if [ -z "$PYENV_TEST_DIR" ]; then
export PYENV_HOOK_PATH="${PYENV_ROOT}/pyenv.d"
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
PATH="${PYENV_TEST_DIR}/bin:$PATH"
PATH="${BATS_TEST_DIRNAME}/../libexec:$PATH"
PATH="${BATS_TEST_DIRNAME}/libexec:$PATH"
PATH="${PYENV_ROOT}/shims:$PATH"
PATH="${PYENV_TEST_DIR}/bin:$PATH"
export PATH
for xdg_var in `env 2>/dev/null | grep ^XDG_ | cut -d= -f1`; do unset "$xdg_var"; done