1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-09 20:13:47 -05:00

Allow multiple versions for pyenv-install

This commit is contained in:
rockandska
2022-12-22 18:35:25 +01:00
parent ff93c58bab
commit 31f372034d
2 changed files with 202 additions and 146 deletions

View File

@@ -10,7 +10,7 @@ setup() {
stub_python_build() {
stub python-build "--lib : $BATS_TEST_DIRNAME/../bin/python-build --lib" "$@"
stub pyenv-latest " : false"
stub pyenv-latest ": false"
}
@test "install proper" {
@@ -24,6 +24,26 @@ stub_python_build() {
unstub pyenv-rehash
}
@test "install proper multi versions" {
#stub python-build "--lib : $BATS_TEST_DIRNAME/../bin/python-build --lib" 'echo python-build "$@"' 'echo python-build "$@"'
#stub pyenv-latest ": false" ": false"
stub_python_build 'echo python-build "$@"' 'echo python-build "$@"'
stub pyenv-latest ": false"
stub pyenv-rehash 'true'
run pyenv-install 3.4.1 3.4.2
assert_success
assert_output <<OUT
python-build 3.4.1 ${TMP}/pyenv/versions/3.4.1
python-build 3.4.2 ${TMP}/pyenv/versions/3.4.2
OUT
unstub python-build
unstub pyenv-latest
unstub pyenv-hooks
unstub pyenv-rehash
}
@test "install resolves a prefix" {
stub_python_build 'echo python-build "$@"'
stub pyenv-latest '-q -k 3.4 : echo 3.4.2'
@@ -37,6 +57,24 @@ stub_python_build() {
unstub pyenv-rehash
}
@test "install resolves a prefix with multi versions" {
stub_python_build 'echo python-build "$@"' 'echo python-build "$@"'
stub pyenv-latest '-q -k 3.4 : echo 3.4.2' '-q -k 3.5 : echo 3.5.2'
stub pyenv-rehash 'true'
pyenv-latest || true # pass through the stub entry added by stub_python_build
run pyenv-install 3.4 3.5
assert_success <<OUT
python-build 3.4.2 ${PYENV_ROOT}/versions/3.4.2
python-build 3.5.2 ${PYENV_ROOT}/versions/3.5.2
OUT
unstub python-build
unstub pyenv-hooks
unstub pyenv-rehash
}
@test "install pyenv local version by default" {
stub_python_build 'echo python-build "$1"'
stub pyenv-local 'echo 3.4.2'
@@ -48,6 +86,21 @@ stub_python_build() {
unstub pyenv-local
}
@test "install pyenv local multi versions by default" {
stub_python_build 'echo python-build "$1"' 'echo python-build "$1"'
stub pyenv-local 'printf "%s\n%s\n" 3.4.2 3.4.1'
stub pyenv-latest ": false"
run pyenv-install
assert_success <<OUT
python-build 3.4.2"
python-build 3.4.1"
OUT
unstub python-build
unstub pyenv-local
}
@test "list available versions" {
stub_python_build \
"--definitions : echo 2.6.9 2.7.9-rc1 2.7.9-rc2 3.4.2 | tr ' ' $'\\n'"
@@ -169,22 +222,23 @@ ${PYENV_ROOT}/plugins/foo/share/python-build
OUT
}
@test "not enough arguments for pyenv-install" {
@test "not enough arguments for pyenv-install if no local version" {
stub_python_build
stub pyenv-help 'install : true'
run pyenv-install
assert_failure
unstub pyenv-help
assert_output ""
}
@test "too many arguments for pyenv-install" {
@test "multi arguments for pyenv-install" {
stub_python_build
stub pyenv-help 'install : true'
run pyenv-install 3.4.1 3.4.2
assert_failure
unstub pyenv-help
assert_success
assert_output ""
}
@test "show help for pyenv-install" {