mirror of
https://github.com/pyenv/pyenv.git
synced 2026-09-11 08:06:16 -04:00
fix powershell tests
This commit is contained in:
parent
61b2726098
commit
2c36d5a9b0
|
|
@ -200,7 +200,7 @@ function print_path() {
|
|||
echo 'end'
|
||||
;;
|
||||
pwsh )
|
||||
echo 'if ( $Env:PATH -match "'"${PYENV_ROOT}/shims"'" ) {'
|
||||
echo 'if ( $Env:PATH -notmatch "'"${PYENV_ROOT}/shims"'" ) {'
|
||||
print_path_prepend_shims
|
||||
echo '}'
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ OUT
|
|||
root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
|
||||
run pyenv-init - pwsh
|
||||
assert_success
|
||||
assert_line "iex (gc ${root}/test/../libexec/../completions/pyenv.pwsh -Raw)"
|
||||
assert_line "iex (gc ${root}/completions/pyenv.pwsh -Raw)"
|
||||
}
|
||||
|
||||
@test "pwsh instructions" {
|
||||
|
|
@ -169,8 +169,9 @@ echo "\$PATH"
|
|||
|
||||
@test "adds shims to PATH with --no-push-path if they're not on PATH (pwsh)" {
|
||||
command -v pwsh >/dev/null || skip "-- pwsh not installed"
|
||||
export PATH="${BATS_TEST_DIRNAME}/../libexec:/usr/bin:/bin:/usr/local/bin"
|
||||
run pwsh -noni -c - <<!
|
||||
PATH="${BATS_TEST_DIRNAME}/../libexec:/usr/bin:/bin:/usr/local/bin"
|
||||
run pwsh -nop -c - <<!
|
||||
#Powershell silently prepends its own PATH entry upon start
|
||||
\$Env:PATH="$PATH"
|
||||
iex ((pyenv init - --no-push-path) -join "\`n")
|
||||
echo "\$Env:PATH"
|
||||
|
|
@ -203,8 +204,9 @@ echo "\$PATH"
|
|||
|
||||
@test "doesn't change PATH with --no-push-path if shims are already on PATH (pwsh)" {
|
||||
command -v pwsh >/dev/null || skip "-- pwsh not installed"
|
||||
export PATH="${BATS_TEST_DIRNAME}/../libexec:/usr/bin:${PYENV_ROOT}/shims:/bin:/usr/local/bin"
|
||||
run pwsh -noni -c - <<!
|
||||
PATH="${BATS_TEST_DIRNAME}/../libexec:/usr/bin:${PYENV_ROOT}/shims:/bin:/usr/local/bin"
|
||||
run pwsh -nop -c - <<!
|
||||
#Powershell silently prepends its own PATH entry upon start
|
||||
\$Env:PATH="$PATH"
|
||||
iex ((pyenv init - --no-push-path) -join "\`n")
|
||||
echo "\$Env:PATH"
|
||||
|
|
|
|||
|
|
@ -33,6 +33,11 @@ setup() {
|
|||
for xdg_var in `env 2>/dev/null | grep ^XDG_ | cut -d= -f1`; do unset "$xdg_var"; done
|
||||
unset xdg_var
|
||||
|
||||
# Workaround for Powershell. When tests are run from a terminal,
|
||||
# Powershell erroneously prints ANSI escape sequences
|
||||
# even if its output is redirected, breaking the comparison logic
|
||||
export NO_COLOR=1
|
||||
|
||||
# If test specific setup exist, run it
|
||||
if [[ $(type -t _setup) == function ]];then
|
||||
_setup
|
||||
|
|
@ -67,8 +72,8 @@ assert_failure() {
|
|||
|
||||
assert_equal() {
|
||||
if [ "$1" != "$2" ]; then
|
||||
{ echo "expected: $1"
|
||||
echo "actual: $2"
|
||||
{ echo "expected: \`$1'"
|
||||
echo "actual: \`$2'"
|
||||
} | flunk
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue