diff --git a/.gitignore b/.gitignore index 71bc9839..17548950 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,8 @@ /libexec/*.dylib /src/Makefile /src/*.o -/bats/ +/bats +/bats-*/ /default-packages .idea *.un~ diff --git a/Makefile b/Makefile index d7a85a15..64724f56 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +BATS_VERSION = v1.10.0 + .PHONY: test test-build test-unit test-plugin # Do not pass in user flags to build tests. @@ -25,5 +27,11 @@ test-build: [ -e $(PYTHON_BUILD_TEST_PREFIX)/bin/pip ] $(PYTHON_BUILD_TEST_PREFIX)/bin/pip -V -bats: - git clone --depth 1 --branch v1.2.0 https://github.com/bats-core/bats-core.git bats +.SECONDARY: bats-$(BATS_VERSION) +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) diff --git a/plugins/python-build/test/pyenv.bats b/plugins/python-build/test/pyenv.bats index e521201c..0108bfc1 100644 --- a/plugins/python-build/test/pyenv.bats +++ b/plugins/python-build/test/pyenv.bats @@ -293,10 +293,11 @@ OUT } @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.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 [ -d "${PYENV_ROOT}/versions/3.10.3" ] diff --git a/test/exec.bats b/test/exec.bats index 97218310..cf818dbe 100644 --- a/test/exec.bats +++ b/test/exec.bats @@ -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 < .python-version - run pyenv-exec nonexistent + run -127 pyenv-exec nonexistent assert_failure <