|
|
|
@ -2,13 +2,8 @@ |
|
|
|
|
|
|
|
load test_helper |
|
|
|
|
|
|
|
_setup() { |
|
|
|
export PATH="${PYENV_TEST_DIR}/bin:$PATH" |
|
|
|
} |
|
|
|
|
|
|
|
@test "read from installed" { |
|
|
|
create_path_executable pyenv-versions <<! |
|
|
|
#!$BASH |
|
|
|
create_stub pyenv-versions <<! |
|
|
|
echo 4.5.6 |
|
|
|
! |
|
|
|
run pyenv-latest 4 |
|
|
|
@ -19,8 +14,7 @@ echo 4.5.6 |
|
|
|
} |
|
|
|
|
|
|
|
@test "read from known" { |
|
|
|
create_path_executable python-build <<! |
|
|
|
#!$BASH |
|
|
|
create_stub python-build <<! |
|
|
|
echo 4.5.6 |
|
|
|
! |
|
|
|
run pyenv-latest -k 4 |
|
|
|
@ -31,8 +25,7 @@ echo 4.5.6 |
|
|
|
} |
|
|
|
|
|
|
|
@test "installed version not found" { |
|
|
|
create_path_executable pyenv-versions <<! |
|
|
|
#!$BASH |
|
|
|
create_stub pyenv-versions <<! |
|
|
|
echo 3.5.6 |
|
|
|
echo 3.10.8 |
|
|
|
! |
|
|
|
@ -44,8 +37,7 @@ pyenv: no installed versions match the prefix \`3.8' |
|
|
|
} |
|
|
|
|
|
|
|
@test "known version not found" { |
|
|
|
create_path_executable python-build <<! |
|
|
|
#!$BASH |
|
|
|
create_stub python-build <<! |
|
|
|
echo 3.5.6 |
|
|
|
echo 3.10.8 |
|
|
|
! |
|
|
|
@ -57,8 +49,7 @@ pyenv: no known versions match the prefix \`3.8' |
|
|
|
} |
|
|
|
|
|
|
|
@test "complete name resolves to itself" { |
|
|
|
create_path_executable pyenv-versions <<! |
|
|
|
#!$BASH |
|
|
|
create_stub pyenv-versions <<! |
|
|
|
echo foo |
|
|
|
echo foo.bar |
|
|
|
! |
|
|
|
@ -72,8 +63,7 @@ foo |
|
|
|
} |
|
|
|
|
|
|
|
@test "sort CPython" { |
|
|
|
create_path_executable pyenv-versions <<! |
|
|
|
#!$BASH |
|
|
|
create_stub pyenv-versions <<! |
|
|
|
echo 2.7.18 |
|
|
|
echo 3.5.6 |
|
|
|
echo 3.10.8 |
|
|
|
@ -87,8 +77,7 @@ echo 3.10.6 |
|
|
|
} |
|
|
|
|
|
|
|
@test "ignores rolling releases, branch tips, alternative srcs, prereleases, virtualenvs; 't' versions if prefix without 't'" { |
|
|
|
create_path_executable pyenv-versions <<! |
|
|
|
#!$BASH |
|
|
|
create_stub pyenv-versions <<! |
|
|
|
echo 3.8.5-dev |
|
|
|
echo 3.8.5-src |
|
|
|
echo 3.8.5-latest |
|
|
|
@ -109,8 +98,7 @@ echo 3.8.1/envs/foo |
|
|
|
} |
|
|
|
|
|
|
|
@test "resolves to a 't' version if prefix has 't'" { |
|
|
|
create_path_executable pyenv-versions <<! |
|
|
|
#!$BASH |
|
|
|
create_stub pyenv-versions <<! |
|
|
|
echo 3.13.2t |
|
|
|
echo 3.13.5 |
|
|
|
echo 3.13.5t |
|
|
|
@ -124,9 +112,7 @@ echo 3.14.6 |
|
|
|
} |
|
|
|
|
|
|
|
@test "falls back to argument with -b" { |
|
|
|
create_path_executable pyenv-versions <<! |
|
|
|
#!$BASH |
|
|
|
! |
|
|
|
create_stub pyenv-versions |
|
|
|
run pyenv-latest -b nonexistent |
|
|
|
assert_failure |
|
|
|
assert_output <<! |
|
|
|
@ -135,9 +121,7 @@ nonexistent |
|
|
|
} |
|
|
|
|
|
|
|
@test "falls back to argument and succeeds with -f" { |
|
|
|
create_path_executable pyenv-versions <<! |
|
|
|
#!$BASH |
|
|
|
! |
|
|
|
create_stub pyenv-versions |
|
|
|
run pyenv-latest -f nonexistent |
|
|
|
assert_success |
|
|
|
assert_output <<! |
|
|
|
|