mirror of
https://github.com/pyenv/pyenv.git
synced 2026-09-10 07:36:16 -04:00
catch circular pyenv call in integration test; fix integraton
This commit is contained in:
parent
6358cbe01f
commit
ce38460f12
|
|
@ -322,12 +322,12 @@ function pyenv {
|
|||
}
|
||||
|
||||
if ( ("${commands[*]}" -split ' ') -contains \$command ) {
|
||||
\$shell_cmds = &pyenv sh-\$command \$args
|
||||
\$shell_cmds = (& (get-command -commandtype application pyenv) sh-\$command \$args)
|
||||
if ( \$shell_cmds.Count -gt 0 ) {
|
||||
iex (\$shell_cmds -join "\`n")
|
||||
}
|
||||
} else {
|
||||
& \$Env:PYENV_ROOT/bin/pyenv \$command \$args
|
||||
& (get-command -commandtype application pyenv) \$command \$args
|
||||
}
|
||||
}
|
||||
EOS
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ shell="$(basename "${PYENV_SHELL:-$SHELL}")"
|
|||
# then tell the shell to empty its command lookup cache.
|
||||
case "$shell" in
|
||||
pwsh)
|
||||
echo "&pyenv rehash"
|
||||
echo "& (get-command pyenv -commandtype application) rehash"
|
||||
;;
|
||||
*)
|
||||
echo "command pyenv rehash"
|
||||
|
|
@ -21,7 +21,7 @@ esac
|
|||
|
||||
case "$shell" in
|
||||
fish | pwsh )
|
||||
# no rehash support
|
||||
# no executable cache
|
||||
;;
|
||||
* )
|
||||
echo "hash -r 2>/dev/null || true"
|
||||
|
|
|
|||
|
|
@ -131,14 +131,20 @@ hash -r 2>/dev/null || true"
|
|||
@test "sh-rehash in pwsh" {
|
||||
create_alt_executable_in_version "3.4" "python"
|
||||
PYENV_SHELL=pwsh run pyenv-sh-rehash
|
||||
assert_success "&pyenv rehash"
|
||||
assert_success "& (get-command pyenv -commandtype application) rehash"
|
||||
}
|
||||
|
||||
@test "sh-rehash in pwsh (integration)" {
|
||||
command -v pwsh >/dev/null || skip "-- pwsh not installed"
|
||||
assert [ ! -x "${PYENV_ROOT}/shims/python" ]
|
||||
create_alt_executable_in_version "3.4" "python"
|
||||
PYENV_SHELL=pwsh run pwsh -nop -c 'iex ((&pyenv-sh-rehash) -join "\`n")'
|
||||
assert_success
|
||||
run pwsh -nop -c -<<'!'
|
||||
$ErrorActionPreference = "Stop"
|
||||
$PSNativeCommandUseErrorActionPreference = $true
|
||||
iex ((& pyenv init - pwsh) -join "`n")
|
||||
& pyenv rehash
|
||||
!
|
||||
assert_success ""
|
||||
assert [ -x "${PYENV_ROOT}/shims/python" ]
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue