mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Init RBENV_TEST_DIR properly and only once during test setup
This commit is contained in:
parent
55f692ba9c
commit
8a0555f8ef
1 changed files with 13 additions and 11 deletions
|
@ -1,18 +1,20 @@
|
||||||
unset RBENV_VERSION
|
unset RBENV_VERSION
|
||||||
unset RBENV_DIR
|
unset RBENV_DIR
|
||||||
|
|
||||||
|
# guard against executing this block twice due to bats internals
|
||||||
|
if [ -z "$RBENV_TEST_DIR" ]; then
|
||||||
|
RBENV_TEST_DIR="${BATS_TMPDIR}/rbenv"
|
||||||
|
export RBENV_TEST_DIR="$(mktemp -d "${RBENV_TEST_DIR}.XXX" 2>/dev/null || echo "$RBENV_TEST_DIR")"
|
||||||
|
|
||||||
if enable -f "${BATS_TEST_DIRNAME}"/../libexec/rbenv-realpath.dylib realpath 2>/dev/null; then
|
if enable -f "${BATS_TEST_DIRNAME}"/../libexec/rbenv-realpath.dylib realpath 2>/dev/null; then
|
||||||
RBENV_TEST_DIR="$(realpath "$BATS_TMPDIR")/rbenv"
|
export RBENV_TEST_DIR="$(realpath "$RBENV_TEST_DIR")"
|
||||||
else
|
else
|
||||||
if [ -n "$RBENV_NATIVE_EXT" ]; then
|
if [ -n "$RBENV_NATIVE_EXT" ]; then
|
||||||
echo "rbenv: failed to load \`realpath' builtin" >&2
|
echo "rbenv: failed to load \`realpath' builtin" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
RBENV_TEST_DIR="$(mktemp -d --tmpdir=$BATS_TMPDIR rbenv.bats.XXX)"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 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 RBENV_ROOT="${RBENV_TEST_DIR}/root"
|
||||||
export HOME="${RBENV_TEST_DIR}/home"
|
export HOME="${RBENV_TEST_DIR}/home"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue