pyenv verification source
Some checks are pending
macos_build / macos_build (3.10) (push) Waiting to run
macos_build / macos_build (3.11) (push) Waiting to run
macos_build / macos_build (3.12) (push) Waiting to run
macos_build / macos_build (3.13) (push) Waiting to run
macos_build / macos_build (3.14) (push) Waiting to run
pyenv_tests / pyenv_tests (macos-14) (push) Waiting to run
pyenv_tests / pyenv_tests (macos-15) (push) Waiting to run
pyenv_tests / pyenv_tests (macos-15-intel) (push) Waiting to run
pyenv_tests / pyenv_tests (macos-26) (push) Waiting to run
pyenv_tests / pyenv_tests (ubuntu-22.04) (push) Waiting to run
pyenv_tests / pyenv_tests (ubuntu-24.04) (push) Waiting to run
ubuntu_build / ubuntu_build (3.10) (push) Waiting to run
ubuntu_build / ubuntu_build (3.11) (push) Waiting to run
ubuntu_build / ubuntu_build (3.12) (push) Waiting to run
ubuntu_build / ubuntu_build (3.13) (push) Waiting to run
ubuntu_build / ubuntu_build (3.14) (push) Waiting to run
Some checks are pending
macos_build / macos_build (3.10) (push) Waiting to run
macos_build / macos_build (3.11) (push) Waiting to run
macos_build / macos_build (3.12) (push) Waiting to run
macos_build / macos_build (3.13) (push) Waiting to run
macos_build / macos_build (3.14) (push) Waiting to run
pyenv_tests / pyenv_tests (macos-14) (push) Waiting to run
pyenv_tests / pyenv_tests (macos-15) (push) Waiting to run
pyenv_tests / pyenv_tests (macos-15-intel) (push) Waiting to run
pyenv_tests / pyenv_tests (macos-26) (push) Waiting to run
pyenv_tests / pyenv_tests (ubuntu-22.04) (push) Waiting to run
pyenv_tests / pyenv_tests (ubuntu-24.04) (push) Waiting to run
ubuntu_build / ubuntu_build (3.10) (push) Waiting to run
ubuntu_build / ubuntu_build (3.11) (push) Waiting to run
ubuntu_build / ubuntu_build (3.12) (push) Waiting to run
ubuntu_build / ubuntu_build (3.13) (push) Waiting to run
ubuntu_build / ubuntu_build (3.14) (push) Waiting to run
This commit is contained in:
88
plugins/python-build/test/cache.bats
Normal file
88
plugins/python-build/test/cache.bats
Normal file
@@ -0,0 +1,88 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
_setup() {
|
||||
export PYTHON_BUILD_SKIP_MIRROR=1
|
||||
export PYTHON_BUILD_CACHE_PATH="$BATS_TEST_TMPDIR/cache"
|
||||
mkdir "$PYTHON_BUILD_CACHE_PATH"
|
||||
}
|
||||
|
||||
|
||||
@test "packages are saved to download cache" {
|
||||
stub curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
|
||||
|
||||
install_fixture definitions/without-checksum
|
||||
|
||||
assert_success
|
||||
assert [ -e "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
|
||||
|
||||
unstub curl
|
||||
}
|
||||
|
||||
|
||||
@test "cached package without checksum" {
|
||||
stub curl
|
||||
|
||||
cp "${FIXTURE_ROOT}/package-1.0.0.tar.gz" "$PYTHON_BUILD_CACHE_PATH"
|
||||
|
||||
install_fixture definitions/without-checksum
|
||||
|
||||
assert_success
|
||||
assert [ -e "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
|
||||
|
||||
unstub curl
|
||||
}
|
||||
|
||||
|
||||
@test "cached package with valid checksum" {
|
||||
stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
|
||||
stub curl
|
||||
|
||||
cp "${FIXTURE_ROOT}/package-1.0.0.tar.gz" "$PYTHON_BUILD_CACHE_PATH"
|
||||
|
||||
install_fixture definitions/with-checksum
|
||||
|
||||
assert_success
|
||||
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
||||
assert [ -e "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
|
||||
|
||||
unstub curl
|
||||
unstub shasum
|
||||
}
|
||||
|
||||
|
||||
@test "cached package with invalid checksum falls back to mirror and updates cache" {
|
||||
export PYTHON_BUILD_SKIP_MIRROR=
|
||||
local checksum="ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
|
||||
|
||||
stub shasum true "echo invalid" "echo $checksum"
|
||||
stub curl "-*I* * : true" \
|
||||
"-q -o * -*S* https://?*/$checksum : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3"
|
||||
|
||||
touch "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz"
|
||||
|
||||
install_fixture definitions/with-checksum
|
||||
|
||||
assert_success
|
||||
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
||||
assert [ -e "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
|
||||
assert diff -q "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" "${FIXTURE_ROOT}/package-1.0.0.tar.gz"
|
||||
|
||||
unstub curl
|
||||
unstub shasum
|
||||
}
|
||||
|
||||
|
||||
@test "nonexistent cache directory is ignored" {
|
||||
stub curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
|
||||
|
||||
export PYTHON_BUILD_CACHE_PATH="${BATS_TEST_TMPDIR}/nonexistent"
|
||||
|
||||
install_fixture definitions/without-checksum
|
||||
|
||||
assert_success
|
||||
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
||||
refute [ -d "$PYTHON_BUILD_CACHE_PATH" ]
|
||||
|
||||
unstub curl
|
||||
}
|
||||
Reference in New Issue
Block a user