mirror of
https://github.com/pyenv/pyenv.git
synced 2025-11-08 03:23:48 -05:00
upgrade bats to v1.10.0
fix bats warnings
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -6,7 +6,8 @@
|
|||||||
/libexec/*.dylib
|
/libexec/*.dylib
|
||||||
/src/Makefile
|
/src/Makefile
|
||||||
/src/*.o
|
/src/*.o
|
||||||
/bats/
|
/bats
|
||||||
|
/bats-*/
|
||||||
/default-packages
|
/default-packages
|
||||||
.idea
|
.idea
|
||||||
*.un~
|
*.un~
|
||||||
|
|||||||
12
Makefile
12
Makefile
@@ -1,3 +1,5 @@
|
|||||||
|
BATS_VERSION = v1.10.0
|
||||||
|
|
||||||
.PHONY: test test-build test-unit test-plugin
|
.PHONY: test test-build test-unit test-plugin
|
||||||
|
|
||||||
# Do not pass in user flags to build tests.
|
# Do not pass in user flags to build tests.
|
||||||
@@ -25,5 +27,11 @@ test-build:
|
|||||||
[ -e $(PYTHON_BUILD_TEST_PREFIX)/bin/pip ]
|
[ -e $(PYTHON_BUILD_TEST_PREFIX)/bin/pip ]
|
||||||
$(PYTHON_BUILD_TEST_PREFIX)/bin/pip -V
|
$(PYTHON_BUILD_TEST_PREFIX)/bin/pip -V
|
||||||
|
|
||||||
bats:
|
.SECONDARY: bats-$(BATS_VERSION)
|
||||||
git clone --depth 1 --branch v1.2.0 https://github.com/bats-core/bats-core.git bats
|
bats-$(BATS_VERSION):
|
||||||
|
rm -rf bats
|
||||||
|
ln -sf bats-$(BATS_VERSION) bats
|
||||||
|
git clone --depth 1 --branch $(BATS_VERSION) https://github.com/bats-core/bats-core.git bats-$(BATS_VERSION)
|
||||||
|
|
||||||
|
.PHONY: bats
|
||||||
|
bats: bats-$(BATS_VERSION)
|
||||||
|
|||||||
@@ -293,10 +293,11 @@ OUT
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "invalid arguments for pyenv-uninstall" {
|
@test "invalid arguments for pyenv-uninstall" {
|
||||||
|
bats_require_minimum_version 1.5.0
|
||||||
mkdir -p "${PYENV_ROOT}/versions/3.10.3"
|
mkdir -p "${PYENV_ROOT}/versions/3.10.3"
|
||||||
mkdir -p "${PYENV_ROOT}/versions/3.10.4"
|
mkdir -p "${PYENV_ROOT}/versions/3.10.4"
|
||||||
|
|
||||||
run pyenv-uninstall -f 3.10.3 --invalid-option 3.10.4
|
run -127 pyenv-uninstall -f 3.10.3 --invalid-option 3.10.4
|
||||||
assert_failure
|
assert_failure
|
||||||
|
|
||||||
assert [ -d "${PYENV_ROOT}/versions/3.10.3" ]
|
assert [ -d "${PYENV_ROOT}/versions/3.10.3" ]
|
||||||
|
|||||||
@@ -15,8 +15,9 @@ create_executable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "fails with invalid version" {
|
@test "fails with invalid version" {
|
||||||
|
bats_require_minimum_version 1.5.0
|
||||||
export PYENV_VERSION="3.4"
|
export PYENV_VERSION="3.4"
|
||||||
run pyenv-exec nonexistent
|
run -127 pyenv-exec nonexistent
|
||||||
assert_failure <<EOF
|
assert_failure <<EOF
|
||||||
pyenv: version \`3.4' is not installed (set by PYENV_VERSION environment variable)
|
pyenv: version \`3.4' is not installed (set by PYENV_VERSION environment variable)
|
||||||
pyenv: nonexistent: command not found
|
pyenv: nonexistent: command not found
|
||||||
@@ -24,10 +25,11 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "fails with invalid version set from file" {
|
@test "fails with invalid version set from file" {
|
||||||
|
bats_require_minimum_version 1.5.0
|
||||||
mkdir -p "$PYENV_TEST_DIR"
|
mkdir -p "$PYENV_TEST_DIR"
|
||||||
cd "$PYENV_TEST_DIR"
|
cd "$PYENV_TEST_DIR"
|
||||||
echo 2.7 > .python-version
|
echo 2.7 > .python-version
|
||||||
run pyenv-exec nonexistent
|
run -127 pyenv-exec nonexistent
|
||||||
assert_failure <<EOF
|
assert_failure <<EOF
|
||||||
pyenv: version \`2.7' is not installed (set by $PWD/.python-version)
|
pyenv: version \`2.7' is not installed (set by $PWD/.python-version)
|
||||||
pyenv: nonexistent: command not found
|
pyenv: nonexistent: command not found
|
||||||
|
|||||||
@@ -60,17 +60,19 @@ create_executable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "doesn't include current directory in PATH search" {
|
@test "doesn't include current directory in PATH search" {
|
||||||
|
bats_require_minimum_version 1.5.0
|
||||||
mkdir -p "$PYENV_TEST_DIR"
|
mkdir -p "$PYENV_TEST_DIR"
|
||||||
cd "$PYENV_TEST_DIR"
|
cd "$PYENV_TEST_DIR"
|
||||||
touch kill-all-humans
|
touch kill-all-humans
|
||||||
chmod +x 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"
|
assert_failure "pyenv: kill-all-humans: command not found"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "version not installed" {
|
@test "version not installed" {
|
||||||
|
bats_require_minimum_version 1.5.0
|
||||||
create_executable "3.4" "py.test"
|
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
|
assert_failure <<OUT
|
||||||
pyenv: version \`3.3' is not installed (set by PYENV_VERSION environment variable)
|
pyenv: version \`3.3' is not installed (set by PYENV_VERSION environment variable)
|
||||||
pyenv: py.test: command not found
|
pyenv: py.test: command not found
|
||||||
@@ -84,8 +86,9 @@ OUT
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "versions not installed" {
|
@test "versions not installed" {
|
||||||
|
bats_require_minimum_version 1.5.0
|
||||||
create_executable "3.4" "py.test"
|
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
|
assert_failure <<OUT
|
||||||
pyenv: version \`2.7' is not installed (set by PYENV_VERSION environment variable)
|
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)
|
pyenv: version \`3.3' is not installed (set by PYENV_VERSION environment variable)
|
||||||
@@ -100,22 +103,25 @@ OUT
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "no executable found" {
|
@test "no executable found" {
|
||||||
|
bats_require_minimum_version 1.5.0
|
||||||
create_executable "2.7" "py.test"
|
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"
|
assert_failure "pyenv: fab: command not found"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "no executable found for system version" {
|
@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"
|
assert_failure "pyenv: rake: command not found"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "executable found in other versions" {
|
@test "executable found in other versions" {
|
||||||
|
bats_require_minimum_version 1.5.0
|
||||||
create_executable "2.7" "python"
|
create_executable "2.7" "python"
|
||||||
create_executable "3.3" "py.test"
|
create_executable "3.3" "py.test"
|
||||||
create_executable "3.4" "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_failure
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
pyenv: py.test: command not found
|
pyenv: py.test: command not found
|
||||||
@@ -188,11 +194,12 @@ exit
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "skip advice supresses error messages" {
|
@test "skip advice supresses error messages" {
|
||||||
|
bats_require_minimum_version 1.5.0
|
||||||
create_executable "2.7" "python"
|
create_executable "2.7" "python"
|
||||||
create_executable "3.3" "py.test"
|
create_executable "3.3" "py.test"
|
||||||
create_executable "3.4" "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_failure
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
pyenv: py.test: command not found
|
pyenv: py.test: command not found
|
||||||
|
|||||||
Reference in New Issue
Block a user