mirror of
https://github.com/pyenv/pyenv.git
synced 2026-09-10 15:46:17 -04:00
add sh-rehash code and integration test
This commit is contained in:
parent
99c8c255a6
commit
37fb8a0925
|
|
@ -11,7 +11,13 @@ shell="$(basename "${PYENV_SHELL:-$SHELL}")"
|
|||
|
||||
# When pyenv shell integration is enabled, delegate to pyenv-rehash,
|
||||
# then tell the shell to empty its command lookup cache.
|
||||
echo "command pyenv rehash"
|
||||
case "$shell" in
|
||||
pwsh)
|
||||
echo "&pyenv rehash"
|
||||
;;
|
||||
*)
|
||||
echo "command pyenv rehash"
|
||||
esac
|
||||
|
||||
case "$shell" in
|
||||
fish | pwsh )
|
||||
|
|
|
|||
|
|
@ -128,10 +128,17 @@ hash -r 2>/dev/null || true"
|
|||
assert [ -x "${PYENV_ROOT}/shims/python" ]
|
||||
}
|
||||
|
||||
@test "sh-rehash in pwsh" {
|
||||
@test "sh-rehash in powershell" {
|
||||
create_executable "3.4" "python"
|
||||
PYENV_SHELL=pwsh run pyenv-sh-rehash
|
||||
assert_success ""
|
||||
assert_success "&pyenv rehash"
|
||||
}
|
||||
|
||||
@test "sh-rehash in powershell (integration)" {
|
||||
command -v pwsh >/dev/null || skip "-- powershell not installed"
|
||||
create_alt_executable_in_version "3.4" "python"
|
||||
run pwsh -NoProfile -Command "iex (&pyenv-sh-rehash)"
|
||||
assert_success
|
||||
assert [ -x "${PYENV_ROOT}/shims/python" ]
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue