tests: Fix "cd: null directory" in OpenSUSE (#3524)

A workaround because tests don't use the Pyenv launcher and setting PYENV_DIR to $PWD at every run invocation is too cumbersome.
This commit is contained in:
native-api 2026-08-25 22:43:59 +03:00 committed by GitHub
parent 234a87e400
commit b0cff001ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -38,7 +38,9 @@ find_local_version_file() {
if [ -n "$target_dir" ]; then if [ -n "$target_dir" ]; then
find_local_version_file "$target_dir" find_local_version_file "$target_dir"
else else
find_local_version_file "$PYENV_DIR" || { # In tests, PYENV_DIR is not set, ultimately leading to "cd: null directory" in OpenSUSE
# While most `cd` implemntations treat an empty argument the same as missing, that's still wrong
find_local_version_file "${PYENV_DIR:=$PWD}" || {
[ "$PYENV_DIR" != "$PWD" ] && find_local_version_file "$PWD" [ "$PYENV_DIR" != "$PWD" ] && find_local_version_file "$PWD"
} || echo "${PYENV_ROOT}/version" } || echo "${PYENV_ROOT}/version"
fi fi