1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-08 11:33:49 -05:00

fix test isolation

Make sur that PYENV_TEST_DIR is created if mktemp failed
mock python3 usage by updating create_executable function
fix test by adding the right PATH
update path in plugin test
replace for loop with while read
don't use symlink for stub
This commit is contained in:
rockandska
2025-09-08 15:36:12 +02:00
parent 857806e6ca
commit 0d987b0e4b
7 changed files with 43 additions and 17 deletions

View File

@@ -378,6 +378,9 @@ OUT
stub port "-q installed libyaml : echo ' libyaml @0.2.5_0 (active)'"
for i in {1..3}; do stub port false; done
stub_make_install
export PYTHON_BUILD_SKIP_HOMEBREW=1
PORT_PREFIX="$(which port)"
PORT_PREFIX="${PORT_PREFIX%/bin/port}"
install_fixture definitions/needs-yaml
assert_success
@@ -403,6 +406,9 @@ OUT
stub port "-q installed readline : echo ' readline @8.2.013_0 (active)'"
for i in {1..2}; do stub port false; done
stub_make_install
export PYTHON_BUILD_SKIP_HOMEBREW=1
PORT_PREFIX="$(which port)"
PORT_PREFIX="${PORT_PREFIX%/bin/port}"
run_inline_definition <<DEF
install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.tar.gz"
@@ -431,6 +437,9 @@ OUT
stub port "-q installed ncurses : echo '$ncurses_libdir'"
stub port false
stub_make_install
export PYTHON_BUILD_SKIP_HOMEBREW=1
PORT_PREFIX="$(which port)"
PORT_PREFIX="${PORT_PREFIX%/bin/port}"
run_inline_definition <<DEF
install_package "Python-3.6.2" "http://python.org/ftp/python/3.6.2/Python-3.6.2.tar.gz"
@@ -845,6 +854,7 @@ OUT
stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.10'
for i in {1..6}; do stub brew false; done
stub sysctl false
stub_make_install
@@ -857,6 +867,7 @@ DEF
unstub uname
unstub sw_vers
unstub brew
unstub make
assert_build_log <<OUT
@@ -872,6 +883,7 @@ OUT
stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.10'
for i in {1..6}; do stub brew false; done
stub sysctl '-n hw.ncpu : echo 4'
stub_make_install
@@ -884,6 +896,7 @@ DEF
unstub uname
unstub sw_vers
unstub brew
unstub sysctl
unstub make

View File

@@ -87,9 +87,9 @@ jython-2.5.4-rc1
jython-2.7-beta1
jython-2.7-beta2
jython-2.7-beta3"
for ver in "$expected"; do
while IFS=$'\n' read -r ver; do
touch "${PYTHON_BUILD_ROOT}/share/python-build/$ver"
done
done <<<"$expected"
run python-build --definitions
assert_success "$expected"
}

View File

@@ -6,9 +6,7 @@ if [ "$FIXTURE_ROOT" != "$BATS_TEST_DIRNAME/fixtures" ]; then
export FIXTURE_ROOT="$BATS_TEST_DIRNAME/fixtures"
export INSTALL_ROOT="$TMP/install"
PATH="/usr/bin:/bin:/usr/sbin:/sbin"
if [ "FreeBSD" = "$(uname -s)" ]; then
PATH="/usr/local/bin:$PATH"
fi
PATH="/usr/local/bin:$PATH"
PATH="$BATS_TEST_DIRNAME/../bin:$PATH"
PATH="$TMP/bin:$PATH"
export PATH
@@ -29,7 +27,7 @@ stub() {
export "${prefix}_STUB_END"=
mkdir -p "${TMP}/bin"
ln -sf "${BATS_TEST_DIRNAME}/stubs/stub" "${TMP}/bin/${program}"
cp "${BATS_TEST_DIRNAME}/stubs/stub" "${TMP}/bin/${program}"
touch "${TMP}/${program}-stub-plan"
for arg in "$@"; do printf "%s\n" "$arg" >> "${TMP}/${program}-stub-plan"; done