From 5c83c4abb7ea93d6d213e73129ceb18be7d7ec58 Mon Sep 17 00:00:00 2001 From: "Yamashita, Yuu" Date: Mon, 1 Aug 2016 00:19:04 +0000 Subject: [PATCH] Add test for `/bin/python` case --- test/prefix.bats | 9 +++++++++ test/test_helper.bash | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/test/prefix.bats b/test/prefix.bats index be9dbaed..1bad28dd 100644 --- a/test/prefix.bats +++ b/test/prefix.bats @@ -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" diff --git a/test/test_helper.bash b/test/test_helper.bash index e11cd8f1..94e36168 100644 --- a/test/test_helper.bash +++ b/test/test_helper.bash @@ -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