mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-14 20:39:55 -05:00
ensure cleaner PATH in test environment
This commit is contained in:
parent
5130b41f5b
commit
8b043038b8
1 changed files with 15 additions and 9 deletions
|
@ -1,14 +1,20 @@
|
|||
RBENV_TEST_DIR="${BATS_TMPDIR}/rbenv"
|
||||
export RBENV_ROOT="${RBENV_TEST_DIR}/root"
|
||||
export HOME="${RBENV_TEST_DIR}/home"
|
||||
|
||||
unset RBENV_VERSION
|
||||
unset RBENV_DIR
|
||||
|
||||
export PATH="${RBENV_TEST_DIR}/bin:$PATH"
|
||||
export PATH="${BATS_TEST_DIRNAME}/../libexec:$PATH"
|
||||
export PATH="${BATS_TEST_DIRNAME}/libexec:$PATH"
|
||||
export PATH="${RBENV_ROOT}/shims:$PATH"
|
||||
RBENV_TEST_DIR="${BATS_TMPDIR}/rbenv"
|
||||
|
||||
# guard against executing this block twice due to bats internals
|
||||
if [ "$RBENV_ROOT" != "${RBENV_TEST_DIR}/root" ]; then
|
||||
export RBENV_ROOT="${RBENV_TEST_DIR}/root"
|
||||
export HOME="${RBENV_TEST_DIR}/home"
|
||||
|
||||
PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
||||
PATH="${RBENV_TEST_DIR}/bin:$PATH"
|
||||
PATH="${BATS_TEST_DIRNAME}/../libexec:$PATH"
|
||||
PATH="${BATS_TEST_DIRNAME}/libexec:$PATH"
|
||||
PATH="${RBENV_ROOT}/shims:$PATH"
|
||||
export PATH
|
||||
fi
|
||||
|
||||
teardown() {
|
||||
rm -rf "$RBENV_TEST_DIR"
|
||||
|
@ -18,7 +24,7 @@ flunk() {
|
|||
{ if [ "$#" -eq 0 ]; then cat -
|
||||
else echo "$@"
|
||||
fi
|
||||
} | sed "s:${RBENV_TEST_DIR}:TEST_DIR:" >&2
|
||||
} | sed "s:${RBENV_TEST_DIR}:TEST_DIR:g" >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue