1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-12 05:23:47 -05:00

Auto-resolve prefixes to the latest version (#2487)

This commit is contained in:
native-api
2022-10-30 03:38:40 +03:00
committed by GitHub
parent 0b5e16add3
commit a12f947cc3
13 changed files with 258 additions and 13 deletions

View File

@@ -60,11 +60,30 @@ NUM_DEFINITIONS="$(find "$BATS_TEST_DIRNAME"/../share/python-build -maxdepth 1 -
}
@test "installing nonexistent definition" {
stub pyenv-latest false
run python-build "nonexistent" "${TMP}/install"
assert [ "$status" -eq 2 ]
assert_output "python-build: definition not found: nonexistent"
}
@test "resolves prefixes via pyenv-latest" {
stub pyenv-latest "echo 2.7.8"
export PYTHON_BUILD_ROOT="$TMP"
mkdir -p "${PYTHON_BUILD_ROOT}/share/python-build"
echo 'echo 2.7.8' > "${PYTHON_BUILD_ROOT}/share/python-build/2.7.8"
run python-build "2.7" "${TMP}/install"
assert_success "2.7.8"
}
@test "doesn't resolve prefixes if pyenv-latest is unavailable" {
export PATH="$(path_without pyenv-latest)"
export PYTHON_BUILD_ROOT="$TMP"
mkdir -p "${PYTHON_BUILD_ROOT}/share/python-build"
echo 'echo 2.7.8' > "${PYTHON_BUILD_ROOT}/share/python-build/2.7.8"
run python-build "2.7" "${TMP}/install"
assert_failure "python-build: definition not found: 2.7"
}
@test "sorting Python versions" {
export PYTHON_BUILD_ROOT="$TMP"
mkdir -p "${PYTHON_BUILD_ROOT}/share/python-build"