1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-14 14:23:53 -05:00

upgrade bats to v1.10.0

fix bats warnings
This commit is contained in:
rockandska
2025-09-15 13:38:35 +02:00
parent 68edd564cf
commit 8990110dcf
5 changed files with 32 additions and 13 deletions

View File

@@ -15,8 +15,9 @@ create_executable() {
}
@test "fails with invalid version" {
bats_require_minimum_version 1.5.0
export PYENV_VERSION="3.4"
run pyenv-exec nonexistent
run -127 pyenv-exec nonexistent
assert_failure <<EOF
pyenv: version \`3.4' is not installed (set by PYENV_VERSION environment variable)
pyenv: nonexistent: command not found
@@ -24,10 +25,11 @@ EOF
}
@test "fails with invalid version set from file" {
bats_require_minimum_version 1.5.0
mkdir -p "$PYENV_TEST_DIR"
cd "$PYENV_TEST_DIR"
echo 2.7 > .python-version
run pyenv-exec nonexistent
run -127 pyenv-exec nonexistent
assert_failure <<EOF
pyenv: version \`2.7' is not installed (set by $PWD/.python-version)
pyenv: nonexistent: command not found

View File

@@ -60,17 +60,19 @@ create_executable() {
}
@test "doesn't include current directory in PATH search" {
bats_require_minimum_version 1.5.0
mkdir -p "$PYENV_TEST_DIR"
cd "$PYENV_TEST_DIR"
touch kill-all-humans
chmod +x kill-all-humans
PATH="$(path_without "kill-all-humans")" PYENV_VERSION=system run pyenv-which kill-all-humans
PATH="$(path_without "kill-all-humans")" PYENV_VERSION=system run -127 pyenv-which kill-all-humans
assert_failure "pyenv: kill-all-humans: command not found"
}
@test "version not installed" {
bats_require_minimum_version 1.5.0
create_executable "3.4" "py.test"
PYENV_VERSION=3.3 run pyenv-which py.test
PYENV_VERSION=3.3 run -127 pyenv-which py.test
assert_failure <<OUT
pyenv: version \`3.3' is not installed (set by PYENV_VERSION environment variable)
pyenv: py.test: command not found
@@ -84,8 +86,9 @@ OUT
}
@test "versions not installed" {
bats_require_minimum_version 1.5.0
create_executable "3.4" "py.test"
PYENV_VERSION=2.7:3.3 run pyenv-which py.test
PYENV_VERSION=2.7:3.3 run -127 pyenv-which py.test
assert_failure <<OUT
pyenv: version \`2.7' is not installed (set by PYENV_VERSION environment variable)
pyenv: version \`3.3' is not installed (set by PYENV_VERSION environment variable)
@@ -100,22 +103,25 @@ OUT
}
@test "no executable found" {
bats_require_minimum_version 1.5.0
create_executable "2.7" "py.test"
PYENV_VERSION=2.7 run pyenv-which fab
PYENV_VERSION=2.7 run -127 pyenv-which fab
assert_failure "pyenv: fab: command not found"
}
@test "no executable found for system version" {
PATH="$(path_without "rake")" PYENV_VERSION=system run pyenv-which rake
bats_require_minimum_version 1.5.0
PATH="$(path_without "rake")" PYENV_VERSION=system run -127 pyenv-which rake
assert_failure "pyenv: rake: command not found"
}
@test "executable found in other versions" {
bats_require_minimum_version 1.5.0
create_executable "2.7" "python"
create_executable "3.3" "py.test"
create_executable "3.4" "py.test"
PYENV_VERSION=2.7 run pyenv-which py.test
PYENV_VERSION=2.7 run -127 pyenv-which py.test
assert_failure
assert_output <<OUT
pyenv: py.test: command not found
@@ -188,11 +194,12 @@ exit
}
@test "skip advice supresses error messages" {
bats_require_minimum_version 1.5.0
create_executable "2.7" "python"
create_executable "3.3" "py.test"
create_executable "3.4" "py.test"
PYENV_VERSION=2.7 run pyenv-which py.test --skip-advice
PYENV_VERSION=2.7 run -127 pyenv-which py.test --skip-advice
assert_failure
assert_output <<OUT
pyenv: py.test: command not found