mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-07 20:31:01 -05:00
Rewrite python-build tests with using PYTHON_BUILD_HTTP_CLIENT
This commit is contained in:
parent
fc90785f75
commit
098fb9f07a
7 changed files with 7 additions and 41 deletions
|
@ -6,9 +6,9 @@ export MAKE=make
|
|||
export MAKE_OPTS="-j 2"
|
||||
export CC=cc
|
||||
export -n PYTHON_CONFIGURE_OPTS
|
||||
export PYTHON_BUILD_HTTP_CLIENT="curl"
|
||||
|
||||
setup() {
|
||||
ensure_not_found_in_path aria2c
|
||||
mkdir -p "$INSTALL_ROOT"
|
||||
stub md5 false
|
||||
stub curl false
|
||||
|
|
|
@ -4,9 +4,9 @@ load test_helper
|
|||
export PYTHON_BUILD_SKIP_MIRROR=1
|
||||
export PYTHON_BUILD_CACHE_PATH="$TMP/cache"
|
||||
export PYTHON_BUILD_CURL_OPTS=
|
||||
export PYTHON_BUILD_HTTP_CLIENT="curl"
|
||||
|
||||
setup() {
|
||||
ensure_not_found_in_path aria2c
|
||||
mkdir "$PYTHON_BUILD_CACHE_PATH"
|
||||
}
|
||||
|
||||
|
|
|
@ -4,10 +4,7 @@ load test_helper
|
|||
export PYTHON_BUILD_SKIP_MIRROR=1
|
||||
export PYTHON_BUILD_CACHE_PATH=
|
||||
export PYTHON_BUILD_CURL_OPTS=
|
||||
|
||||
setup() {
|
||||
ensure_not_found_in_path aria2c
|
||||
}
|
||||
export PYTHON_BUILD_HTTP_CLIENT="curl"
|
||||
|
||||
|
||||
@test "package URL without checksum" {
|
||||
|
|
|
@ -4,9 +4,9 @@ load test_helper
|
|||
export PYTHON_BUILD_SKIP_MIRROR=1
|
||||
export PYTHON_BUILD_CACHE_PATH=
|
||||
export PYTHON_BUILD_ARIA2_OPTS=
|
||||
export PYTHON_BUILD_HTTP_CLIENT="curl"
|
||||
|
||||
setup() {
|
||||
ensure_not_found_in_path aria2c
|
||||
export PYTHON_BUILD_BUILD_PATH="${TMP}/source"
|
||||
mkdir -p "${PYTHON_BUILD_BUILD_PATH}"
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ setup() {
|
|||
}
|
||||
|
||||
@test "using aria2c if available" {
|
||||
export PYTHON_BUILD_HTTP_CLIENT="aria2c"
|
||||
stub aria2c "--allow-overwrite=true --no-conf=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$4"
|
||||
|
||||
install_fixture definitions/without-checksum
|
||||
|
|
|
@ -5,10 +5,7 @@ export PYTHON_BUILD_SKIP_MIRROR=
|
|||
export PYTHON_BUILD_CACHE_PATH=
|
||||
export PYTHON_BUILD_MIRROR_URL=http://mirror.example.com
|
||||
export PYTHON_BUILD_CURL_OPTS=
|
||||
|
||||
setup() {
|
||||
ensure_not_found_in_path aria2c
|
||||
}
|
||||
export PYTHON_BUILD_HTTP_CLIENT="curl"
|
||||
|
||||
|
||||
@test "package URL without checksum bypasses mirror" {
|
||||
|
|
|
@ -5,11 +5,11 @@ export PYTHON_BUILD_CACHE_PATH="$TMP/cache"
|
|||
export MAKE=make
|
||||
export MAKE_OPTS="-j 2"
|
||||
export CC=cc
|
||||
export PYTHON_BUILD_HTTP_CLIENT="curl"
|
||||
|
||||
export TMP_FIXTURES="$TMP/fixtures"
|
||||
|
||||
setup() {
|
||||
ensure_not_found_in_path aria2c
|
||||
mkdir -p "$INSTALL_ROOT"
|
||||
stub md5 false
|
||||
stub curl false
|
||||
|
|
|
@ -9,35 +9,6 @@ if [ "$FIXTURE_ROOT" != "$BATS_TEST_DIRNAME/fixtures" ]; then
|
|||
export PATH
|
||||
fi
|
||||
|
||||
remove_command_from_path() {
|
||||
OLDIFS="${IFS}"
|
||||
local cmd="$1"
|
||||
local path
|
||||
local paths=()
|
||||
IFS=:
|
||||
for path in ${PATH}; do
|
||||
if [ -e "${path}/${cmd}" ]; then
|
||||
local tmp_path="$(mktemp -d "${TMP}/path.XXXXX")"
|
||||
ln -fs "${path}"/* "${tmp_path}"
|
||||
rm -f "${tmp_path}/${cmd}"
|
||||
paths["${#paths[@]}"]="${tmp_path}"
|
||||
else
|
||||
paths["${#paths[@]}"]="${path}"
|
||||
fi
|
||||
done
|
||||
export PATH="${paths[*]}"
|
||||
IFS="${OLDIFS}"
|
||||
}
|
||||
|
||||
ensure_not_found_in_path() {
|
||||
local cmd
|
||||
for cmd; do
|
||||
if command -v "${cmd}" 1>/dev/null 2>&1; then
|
||||
remove_command_from_path "${cmd}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
teardown() {
|
||||
rm -fr "${TMP:?}"/*
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue