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

Use aria2c as the download if available (#534)

This commit is contained in:
Yamashita, Yuu
2016-02-08 12:27:46 +00:00
parent c8ab429d7b
commit b116f341fe
7 changed files with 67 additions and 50 deletions

View File

@@ -10,19 +10,19 @@ setup() {
@test "packages are saved to download cache" {
stub curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
stub aria2c "-q -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3"
install_fixture definitions/without-checksum
assert_success
assert [ -e "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
unstub curl
unstub aria2c
}
@test "cached package without checksum" {
stub curl
stub aria2c
cp "${FIXTURE_ROOT}/package-1.0.0.tar.gz" "$PYTHON_BUILD_CACHE_PATH"
@@ -31,13 +31,13 @@ setup() {
assert_success
assert [ -e "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
unstub curl
unstub aria2c
}
@test "cached package with valid checksum" {
stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
stub curl
stub aria2c
cp "${FIXTURE_ROOT}/package-1.0.0.tar.gz" "$PYTHON_BUILD_CACHE_PATH"
@@ -47,7 +47,7 @@ setup() {
assert [ -x "${INSTALL_ROOT}/bin/package" ]
assert [ -e "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
unstub curl
unstub aria2c
unstub shasum
}
@@ -57,8 +57,8 @@ setup() {
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"
stub aria2c "-q --dry-run * : true" \
"-q -o * https://?*/$checksum : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3"
touch "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz"
@@ -69,13 +69,13 @@ setup() {
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 aria2c
unstub shasum
}
@test "nonexistent cache directory is ignored" {
stub curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
stub aria2c "-q -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3"
export PYTHON_BUILD_CACHE_PATH="${TMP}/nonexistent"
@@ -85,5 +85,5 @@ setup() {
assert [ -x "${INSTALL_ROOT}/bin/package" ]
refute [ -d "$PYTHON_BUILD_CACHE_PATH" ]
unstub curl
unstub aria2c
}