diff --git a/test/exec.bats b/test/exec.bats index 817d1aee..952ffeb7 100644 --- a/test/exec.bats +++ b/test/exec.bats @@ -15,22 +15,22 @@ create_executable() { } @test "fails with invalid version" { - export PYENV_VERSION="2.0" + export PYENV_VERSION="3.4" run pyenv-exec python -v - assert_failure "pyenv: version \`2.0' is not installed" + assert_failure "pyenv: version \`3.4' is not installed" } @test "completes with names of executables" { - export PYENV_VERSION="2.0" + export PYENV_VERSION="3.4" + create_executable "fab" "#!/bin/sh" create_executable "python" "#!/bin/sh" - create_executable "rake" "#!/bin/sh" pyenv-rehash run pyenv-completions exec assert_success assert_output <" { - export PYENV_VERSION="2.0" + export PYENV_VERSION="3.4" # emulate `python -S' behavior create_executable "python" < .pyenv-version - echo "2.0" > .python-version + echo "2.7" > .pyenv-version + echo "3.4" > .python-version run pyenv-local - assert_success "2.0" + assert_success "3.4" } @test "ignores version in parent directory" { @@ -42,7 +42,7 @@ setup() { @test "ignores PYENV_DIR" { echo "1.2.3" > .python-version mkdir -p "$HOME" - echo "2.0-home" > "${HOME}/.python-version" + echo "3.4-home" > "${HOME}/.python-version" PYENV_DIR="$HOME" run pyenv-local assert_success "1.2.3" } @@ -65,27 +65,27 @@ setup() { } @test "renames .pyenv-version to .python-version" { - echo "1.8.7" > .pyenv-version - mkdir -p "${PYENV_ROOT}/versions/1.9.3" + echo "2.7.6" > .pyenv-version + mkdir -p "${PYENV_ROOT}/versions/3.3.3" run pyenv-local - assert_success "1.8.7" - run pyenv-local "1.9.3" + assert_success "2.7.6" + run pyenv-local "3.3.3" assert_success assert_output < .pyenv-version - assert [ ! -e "${PYENV_ROOT}/versions/1.9.3" ] - run pyenv-local "1.9.3" - assert_failure "pyenv: version \`1.9.3' not installed" + echo "2.7.6" > .pyenv-version + assert [ ! -e "${PYENV_ROOT}/versions/3.3.3" ] + run pyenv-local "3.3.3" + assert_failure "pyenv: version \`3.3.3' not installed" assert [ ! -e .python-version ] - assert [ "$(cat .pyenv-version)" = "1.8.7" ] + assert [ "$(cat .pyenv-version)" = "2.7.6" ] } @test "unsets local version" { diff --git a/test/rehash.bats b/test/rehash.bats index b6682a98..ab049527 100755 --- a/test/rehash.bats +++ b/test/rehash.bats @@ -32,14 +32,14 @@ create_executable() { } @test "creates shims" { - create_executable "1.8" "python" - create_executable "1.8" "rake" - create_executable "2.0" "python" - create_executable "2.0" "rspec" + create_executable "2.7" "python" + create_executable "2.7" "fab" + create_executable "3.4" "python" + create_executable "3.4" "py.test" + assert [ ! -e "${PYENV_ROOT}/shims/fab" ] assert [ ! -e "${PYENV_ROOT}/shims/python" ] - assert [ ! -e "${PYENV_ROOT}/shims/rake" ] - assert [ ! -e "${PYENV_ROOT}/shims/rspec" ] + assert [ ! -e "${PYENV_ROOT}/shims/py.test" ] run pyenv-rehash assert_success "" @@ -47,9 +47,9 @@ create_executable() { run ls "${PYENV_ROOT}/shims" assert_success assert_output </dev/null || true" assert [ -x "${PYENV_ROOT}/shims/python" ] } @test "sh-rehash in fish" { - create_executable "2.0" "python" + create_executable "3.4" "python" PYENV_SHELL=fish run pyenv-sh-rehash assert_success "" assert [ -x "${PYENV_ROOT}/shims/python" ] diff --git a/test/version-file-read.bats b/test/version-file-read.bats index 7414aa01..851505d2 100644 --- a/test/version-file-read.bats +++ b/test/version-file-read.bats @@ -24,43 +24,43 @@ setup() { } @test "reads simple version file" { - cat > my-version <<<"1.9.3" + cat > my-version <<<"3.3.3" run pyenv-version-file-read my-version - assert_success "1.9.3" + assert_success "3.3.3" } @test "ignores leading spaces" { - cat > my-version <<<" 1.9.3" + cat > my-version <<<" 3.3.3" run pyenv-version-file-read my-version - assert_success "1.9.3" + assert_success "3.3.3" } @test "reads only the first word from file" { - cat > my-version <<<"1.9.3-p194@tag 1.8.7 hi" + cat > my-version <<<"3.3.3-p194@tag 2.7.6 hi" run pyenv-version-file-read my-version - assert_success "1.9.3-p194@tag:1.8.7:hi" + assert_success "3.3.3-p194@tag:2.7.6:hi" } @test "loads only the first line in file" { cat > my-version < my-version < my-version + echo -n "2.7.6" > my-version run pyenv-version-file-read my-version - assert_success "1.8.7" + assert_success "2.7.6" } diff --git a/test/version-file-write.bats b/test/version-file-write.bats index be23bbb4..aa7100d6 100644 --- a/test/version-file-write.bats +++ b/test/version-file-write.bats @@ -16,15 +16,15 @@ setup() { @test "setting nonexistent version fails" { assert [ ! -e ".python-version" ] - run pyenv-version-file-write ".python-version" "1.8.7" - assert_failure "pyenv: version \`1.8.7' not installed" + run pyenv-version-file-write ".python-version" "2.7.6" + assert_failure "pyenv: version \`2.7.6' not installed" assert [ ! -e ".python-version" ] } @test "writes value to arbitrary file" { - mkdir -p "${PYENV_ROOT}/versions/1.8.7" + mkdir -p "${PYENV_ROOT}/versions/2.7.6" assert [ ! -e "my-version" ] - run pyenv-version-file-write "${PWD}/my-version" "1.8.7" + run pyenv-version-file-write "${PWD}/my-version" "2.7.6" assert_success "" - assert [ "$(cat my-version)" = "1.8.7" ] + assert [ "$(cat my-version)" = "2.7.6" ] } diff --git a/test/version-name.bats b/test/version-name.bats index efbaa347..2d7ebe20 100644 --- a/test/version-name.bats +++ b/test/version-name.bats @@ -23,28 +23,28 @@ setup() { } @test "PYENV_VERSION has precedence over local" { - create_version "1.8.7" - create_version "1.9.3" + create_version "2.7.6" + create_version "3.3.3" - cat > ".python-version" <<<"1.8.7" + cat > ".python-version" <<<"2.7.6" run pyenv-version-name - assert_success "1.8.7" + assert_success "2.7.6" - PYENV_VERSION=1.9.3 run pyenv-version-name - assert_success "1.9.3" + PYENV_VERSION=3.3.3 run pyenv-version-name + assert_success "3.3.3" } @test "local file has precedence over global" { - create_version "1.8.7" - create_version "1.9.3" + create_version "2.7.6" + create_version "3.3.3" - cat > "${PYENV_ROOT}/version" <<<"1.8.7" + cat > "${PYENV_ROOT}/version" <<<"2.7.6" run pyenv-version-name - assert_success "1.8.7" + assert_success "2.7.6" - cat > ".python-version" <<<"1.9.3" + cat > ".python-version" <<<"3.3.3" run pyenv-version-name - assert_success "1.9.3" + assert_success "3.3.3" } @test "missing version" { @@ -53,13 +53,13 @@ setup() { } @test "version with prefix in name" { - create_version "1.8.7" - cat > ".python-version" <<<"python-1.8.7" + create_version "2.7.6" + cat > ".python-version" <<<"python-2.7.6" run pyenv-version-name assert_success assert_output < ".python-version" <<<"1.9.3" + create_version "3.3.3" + cat > ".python-version" <<<"3.3.3" run pyenv-version - assert_success "1.9.3 (set by ${PWD}/.python-version)" + assert_success "3.3.3 (set by ${PWD}/.python-version)" } @test "set by global file" { - create_version "1.9.3" - cat > "${PYENV_ROOT}/version" <<<"1.9.3" + create_version "3.3.3" + cat > "${PYENV_ROOT}/version" <<<"3.3.3" run pyenv-version - assert_success "1.9.3 (set by ${PYENV_ROOT}/version)" + assert_success "3.3.3 (set by ${PYENV_ROOT}/version)" } diff --git a/test/versions.bats b/test/versions.bats index 44fad1de..840a0adc 100644 --- a/test/versions.bats +++ b/test/versions.bats @@ -32,84 +32,84 @@ stub_system_python() { @test "single version installed" { stub_system_python - create_version "1.9" + create_version "3.3" run pyenv-versions assert_success assert_output < "${PYENV_ROOT}/version" <<<"1.9.3" + create_version "3.3.3" + create_version "3.4.0" + cat > "${PYENV_ROOT}/version" <<<"3.3.3" run pyenv-versions assert_success assert_output < ".python-version" <<<"1.9.3" + create_version "3.3.3" + create_version "3.4.0" + cat > ".python-version" <<<"3.3.3" run pyenv-versions assert_success assert_output <