fix: Fix shell completions tests for pyenv-init

In `test_helper.bash`:
set

PATH="${BATS_TEST_DIRNAME%/*}/libexec:$PATH"

instead of

PATH="${BATS_TEST_DIRNAME}../libexec:$PATH"

it essentially enables us to expect

`${exec_root}/completions/pyenv.bash`

instead of something like

`${exec_root}/test/../completions/pyenv.zsh
This commit is contained in:
Christian Fredrik Johnsen 2024-12-21 14:00:34 +01:00
parent 2e1c756793
commit b1882cb6fe
2 changed files with 5 additions and 7 deletions

View File

@ -36,11 +36,10 @@ create_executable() {
}
@test "setup shell completions" {
root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
export PYENV_ROOT=$root
exec_root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
run pyenv-init - bash
assert_success
assert_line "source '${root}/completions/pyenv.bash'"
assert_line "source '${exec_root}/completions/pyenv.bash'"
}
@test "detect parent shell" {
@ -63,11 +62,10 @@ OUT
}
@test "setup shell completions (fish)" {
root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
export PYENV_ROOT=$root
exec_root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
run pyenv-init - fish
assert_success
assert_line "source '${root}/completions/pyenv.fish'"
assert_line "source '${exec_root}/completions/pyenv.fish'"
}
@test "fish instructions" {

View File

@ -21,7 +21,7 @@ if [ -z "$PYENV_TEST_DIR" ]; then
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="${BATS_TEST_DIRNAME}/libexec:$PATH"
PATH="${PYENV_ROOT}/shims:$PATH"
export PATH