mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-14 20:39:55 -05:00
Modify applications and versions for Python
This commit is contained in:
parent
3dd9332eee
commit
319721b380
10 changed files with 145 additions and 145 deletions
|
@ -15,22 +15,22 @@ create_executable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "fails with invalid version" {
|
@test "fails with invalid version" {
|
||||||
export PYENV_VERSION="2.0"
|
export PYENV_VERSION="3.4"
|
||||||
run pyenv-exec python -v
|
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" {
|
@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 "python" "#!/bin/sh"
|
||||||
create_executable "rake" "#!/bin/sh"
|
|
||||||
|
|
||||||
pyenv-rehash
|
pyenv-rehash
|
||||||
run pyenv-completions exec
|
run pyenv-completions exec
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
|
fab
|
||||||
python
|
python
|
||||||
rake
|
|
||||||
OUT
|
OUT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ SH
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "forwards all arguments" {
|
@test "forwards all arguments" {
|
||||||
export PYENV_VERSION="2.0"
|
export PYENV_VERSION="3.4"
|
||||||
create_executable "python" <<SH
|
create_executable "python" <<SH
|
||||||
#!$BASH
|
#!$BASH
|
||||||
echo \$0
|
echo \$0
|
||||||
|
@ -73,7 +73,7 @@ SH
|
||||||
run pyenv-exec python -w "/path to/python script.rb" -- extra args
|
run pyenv-exec python -w "/path to/python script.rb" -- extra args
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
${PYENV_ROOT}/versions/2.0/bin/python
|
${PYENV_ROOT}/versions/3.4/bin/python
|
||||||
-w
|
-w
|
||||||
/path to/python script.rb
|
/path to/python script.rb
|
||||||
--
|
--
|
||||||
|
@ -83,7 +83,7 @@ OUT
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "supports python -S <cmd>" {
|
@test "supports python -S <cmd>" {
|
||||||
export PYENV_VERSION="2.0"
|
export PYENV_VERSION="3.4"
|
||||||
|
|
||||||
# emulate `python -S' behavior
|
# emulate `python -S' behavior
|
||||||
create_executable "python" <<SH
|
create_executable "python" <<SH
|
||||||
|
@ -98,16 +98,16 @@ if [[ \$1 == "-S"* ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo 'python 2.0 (pyenv test)'
|
echo 'python 3.4 (pyenv test)'
|
||||||
fi
|
fi
|
||||||
SH
|
SH
|
||||||
|
|
||||||
create_executable "rake" <<SH
|
create_executable "fab" <<SH
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
echo hello rake
|
echo hello fab
|
||||||
SH
|
SH
|
||||||
|
|
||||||
pyenv-rehash
|
pyenv-rehash
|
||||||
run python -S rake
|
run python -S fab
|
||||||
assert_success "hello rake"
|
assert_success "hello fab"
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,10 +26,10 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "local .python-version has precedence over .pyenv-version" {
|
@test "local .python-version has precedence over .pyenv-version" {
|
||||||
echo "1.8" > .pyenv-version
|
echo "2.7" > .pyenv-version
|
||||||
echo "2.0" > .python-version
|
echo "3.4" > .python-version
|
||||||
run pyenv-local
|
run pyenv-local
|
||||||
assert_success "2.0"
|
assert_success "3.4"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "ignores version in parent directory" {
|
@test "ignores version in parent directory" {
|
||||||
|
@ -42,7 +42,7 @@ setup() {
|
||||||
@test "ignores PYENV_DIR" {
|
@test "ignores PYENV_DIR" {
|
||||||
echo "1.2.3" > .python-version
|
echo "1.2.3" > .python-version
|
||||||
mkdir -p "$HOME"
|
mkdir -p "$HOME"
|
||||||
echo "2.0-home" > "${HOME}/.python-version"
|
echo "3.4-home" > "${HOME}/.python-version"
|
||||||
PYENV_DIR="$HOME" run pyenv-local
|
PYENV_DIR="$HOME" run pyenv-local
|
||||||
assert_success "1.2.3"
|
assert_success "1.2.3"
|
||||||
}
|
}
|
||||||
|
@ -65,27 +65,27 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "renames .pyenv-version to .python-version" {
|
@test "renames .pyenv-version to .python-version" {
|
||||||
echo "1.8.7" > .pyenv-version
|
echo "2.7.6" > .pyenv-version
|
||||||
mkdir -p "${PYENV_ROOT}/versions/1.9.3"
|
mkdir -p "${PYENV_ROOT}/versions/3.3.3"
|
||||||
run pyenv-local
|
run pyenv-local
|
||||||
assert_success "1.8.7"
|
assert_success "2.7.6"
|
||||||
run pyenv-local "1.9.3"
|
run pyenv-local "3.3.3"
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
pyenv: removed existing \`.pyenv-version' file and migrated
|
pyenv: removed existing \`.pyenv-version' file and migrated
|
||||||
local version specification to \`.python-version' file
|
local version specification to \`.python-version' file
|
||||||
OUT
|
OUT
|
||||||
assert [ ! -e .pyenv-version ]
|
assert [ ! -e .pyenv-version ]
|
||||||
assert [ "$(cat .python-version)" = "1.9.3" ]
|
assert [ "$(cat .python-version)" = "3.3.3" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "doesn't rename .pyenv-version if changing the version failed" {
|
@test "doesn't rename .pyenv-version if changing the version failed" {
|
||||||
echo "1.8.7" > .pyenv-version
|
echo "2.7.6" > .pyenv-version
|
||||||
assert [ ! -e "${PYENV_ROOT}/versions/1.9.3" ]
|
assert [ ! -e "${PYENV_ROOT}/versions/3.3.3" ]
|
||||||
run pyenv-local "1.9.3"
|
run pyenv-local "3.3.3"
|
||||||
assert_failure "pyenv: version \`1.9.3' not installed"
|
assert_failure "pyenv: version \`3.3.3' not installed"
|
||||||
assert [ ! -e .python-version ]
|
assert [ ! -e .python-version ]
|
||||||
assert [ "$(cat .pyenv-version)" = "1.8.7" ]
|
assert [ "$(cat .pyenv-version)" = "2.7.6" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "unsets local version" {
|
@test "unsets local version" {
|
||||||
|
|
|
@ -32,14 +32,14 @@ create_executable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "creates shims" {
|
@test "creates shims" {
|
||||||
create_executable "1.8" "python"
|
create_executable "2.7" "python"
|
||||||
create_executable "1.8" "rake"
|
create_executable "2.7" "fab"
|
||||||
create_executable "2.0" "python"
|
create_executable "3.4" "python"
|
||||||
create_executable "2.0" "rspec"
|
create_executable "3.4" "py.test"
|
||||||
|
|
||||||
|
assert [ ! -e "${PYENV_ROOT}/shims/fab" ]
|
||||||
assert [ ! -e "${PYENV_ROOT}/shims/python" ]
|
assert [ ! -e "${PYENV_ROOT}/shims/python" ]
|
||||||
assert [ ! -e "${PYENV_ROOT}/shims/rake" ]
|
assert [ ! -e "${PYENV_ROOT}/shims/py.test" ]
|
||||||
assert [ ! -e "${PYENV_ROOT}/shims/rspec" ]
|
|
||||||
|
|
||||||
run pyenv-rehash
|
run pyenv-rehash
|
||||||
assert_success ""
|
assert_success ""
|
||||||
|
@ -47,9 +47,9 @@ create_executable() {
|
||||||
run ls "${PYENV_ROOT}/shims"
|
run ls "${PYENV_ROOT}/shims"
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
|
fab
|
||||||
|
py.test
|
||||||
python
|
python
|
||||||
rake
|
|
||||||
rspec
|
|
||||||
OUT
|
OUT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,8 +58,8 @@ OUT
|
||||||
touch "${PYENV_ROOT}/shims/oldshim1"
|
touch "${PYENV_ROOT}/shims/oldshim1"
|
||||||
chmod +x "${PYENV_ROOT}/shims/oldshim1"
|
chmod +x "${PYENV_ROOT}/shims/oldshim1"
|
||||||
|
|
||||||
create_executable "2.0" "rake"
|
create_executable "3.4" "fab"
|
||||||
create_executable "2.0" "python"
|
create_executable "3.4" "python"
|
||||||
|
|
||||||
run pyenv-rehash
|
run pyenv-rehash
|
||||||
assert_success ""
|
assert_success ""
|
||||||
|
@ -69,10 +69,10 @@ OUT
|
||||||
|
|
||||||
@test "binary install locations containing spaces" {
|
@test "binary install locations containing spaces" {
|
||||||
create_executable "dirname1 p247" "python"
|
create_executable "dirname1 p247" "python"
|
||||||
create_executable "dirname2 preview1" "rspec"
|
create_executable "dirname2 preview1" "py.test"
|
||||||
|
|
||||||
assert [ ! -e "${PYENV_ROOT}/shims/python" ]
|
assert [ ! -e "${PYENV_ROOT}/shims/python" ]
|
||||||
assert [ ! -e "${PYENV_ROOT}/shims/rspec" ]
|
assert [ ! -e "${PYENV_ROOT}/shims/py.test" ]
|
||||||
|
|
||||||
run pyenv-rehash
|
run pyenv-rehash
|
||||||
assert_success ""
|
assert_success ""
|
||||||
|
@ -80,8 +80,8 @@ OUT
|
||||||
run ls "${PYENV_ROOT}/shims"
|
run ls "${PYENV_ROOT}/shims"
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
|
py.test
|
||||||
python
|
python
|
||||||
rspec
|
|
||||||
OUT
|
OUT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,14 +100,14 @@ SH
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "sh-rehash in bash" {
|
@test "sh-rehash in bash" {
|
||||||
create_executable "2.0" "python"
|
create_executable "3.4" "python"
|
||||||
PYENV_SHELL=bash run pyenv-sh-rehash
|
PYENV_SHELL=bash run pyenv-sh-rehash
|
||||||
assert_success "hash -r 2>/dev/null || true"
|
assert_success "hash -r 2>/dev/null || true"
|
||||||
assert [ -x "${PYENV_ROOT}/shims/python" ]
|
assert [ -x "${PYENV_ROOT}/shims/python" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "sh-rehash in fish" {
|
@test "sh-rehash in fish" {
|
||||||
create_executable "2.0" "python"
|
create_executable "3.4" "python"
|
||||||
PYENV_SHELL=fish run pyenv-sh-rehash
|
PYENV_SHELL=fish run pyenv-sh-rehash
|
||||||
assert_success ""
|
assert_success ""
|
||||||
assert [ -x "${PYENV_ROOT}/shims/python" ]
|
assert [ -x "${PYENV_ROOT}/shims/python" ]
|
||||||
|
|
|
@ -24,43 +24,43 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "reads simple version file" {
|
@test "reads simple version file" {
|
||||||
cat > my-version <<<"1.9.3"
|
cat > my-version <<<"3.3.3"
|
||||||
run pyenv-version-file-read my-version
|
run pyenv-version-file-read my-version
|
||||||
assert_success "1.9.3"
|
assert_success "3.3.3"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "ignores leading spaces" {
|
@test "ignores leading spaces" {
|
||||||
cat > my-version <<<" 1.9.3"
|
cat > my-version <<<" 3.3.3"
|
||||||
run pyenv-version-file-read my-version
|
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" {
|
@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
|
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" {
|
@test "loads only the first line in file" {
|
||||||
cat > my-version <<IN
|
cat > my-version <<IN
|
||||||
1.8.7 one
|
2.7.6 one
|
||||||
1.9.3 two
|
3.3.3 two
|
||||||
IN
|
IN
|
||||||
run pyenv-version-file-read my-version
|
run pyenv-version-file-read my-version
|
||||||
assert_success "1.8.7:one:1.9.3:two"
|
assert_success "2.7.6:one:3.3.3:two"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "ignores leading blank lines" {
|
@test "ignores leading blank lines" {
|
||||||
cat > my-version <<IN
|
cat > my-version <<IN
|
||||||
|
|
||||||
1.9.3
|
3.3.3
|
||||||
IN
|
IN
|
||||||
run pyenv-version-file-read my-version
|
run pyenv-version-file-read my-version
|
||||||
assert_success "1.9.3"
|
assert_success "3.3.3"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "handles the file with no trailing newline" {
|
@test "handles the file with no trailing newline" {
|
||||||
echo -n "1.8.7" > my-version
|
echo -n "2.7.6" > my-version
|
||||||
run pyenv-version-file-read my-version
|
run pyenv-version-file-read my-version
|
||||||
assert_success "1.8.7"
|
assert_success "2.7.6"
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,15 +16,15 @@ setup() {
|
||||||
|
|
||||||
@test "setting nonexistent version fails" {
|
@test "setting nonexistent version fails" {
|
||||||
assert [ ! -e ".python-version" ]
|
assert [ ! -e ".python-version" ]
|
||||||
run pyenv-version-file-write ".python-version" "1.8.7"
|
run pyenv-version-file-write ".python-version" "2.7.6"
|
||||||
assert_failure "pyenv: version \`1.8.7' not installed"
|
assert_failure "pyenv: version \`2.7.6' not installed"
|
||||||
assert [ ! -e ".python-version" ]
|
assert [ ! -e ".python-version" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "writes value to arbitrary file" {
|
@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" ]
|
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_success ""
|
||||||
assert [ "$(cat my-version)" = "1.8.7" ]
|
assert [ "$(cat my-version)" = "2.7.6" ]
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,28 +23,28 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "PYENV_VERSION has precedence over local" {
|
@test "PYENV_VERSION has precedence over local" {
|
||||||
create_version "1.8.7"
|
create_version "2.7.6"
|
||||||
create_version "1.9.3"
|
create_version "3.3.3"
|
||||||
|
|
||||||
cat > ".python-version" <<<"1.8.7"
|
cat > ".python-version" <<<"2.7.6"
|
||||||
run pyenv-version-name
|
run pyenv-version-name
|
||||||
assert_success "1.8.7"
|
assert_success "2.7.6"
|
||||||
|
|
||||||
PYENV_VERSION=1.9.3 run pyenv-version-name
|
PYENV_VERSION=3.3.3 run pyenv-version-name
|
||||||
assert_success "1.9.3"
|
assert_success "3.3.3"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "local file has precedence over global" {
|
@test "local file has precedence over global" {
|
||||||
create_version "1.8.7"
|
create_version "2.7.6"
|
||||||
create_version "1.9.3"
|
create_version "3.3.3"
|
||||||
|
|
||||||
cat > "${PYENV_ROOT}/version" <<<"1.8.7"
|
cat > "${PYENV_ROOT}/version" <<<"2.7.6"
|
||||||
run pyenv-version-name
|
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
|
run pyenv-version-name
|
||||||
assert_success "1.9.3"
|
assert_success "3.3.3"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "missing version" {
|
@test "missing version" {
|
||||||
|
@ -53,13 +53,13 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "version with prefix in name" {
|
@test "version with prefix in name" {
|
||||||
create_version "1.8.7"
|
create_version "2.7.6"
|
||||||
cat > ".python-version" <<<"python-1.8.7"
|
cat > ".python-version" <<<"python-2.7.6"
|
||||||
run pyenv-version-name
|
run pyenv-version-name
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
warning: ignoring extraneous \`python-' prefix in version \`python-1.8.7'
|
warning: ignoring extraneous \`python-' prefix in version \`python-2.7.6'
|
||||||
(set by ${PWD}/.python-version)
|
(set by ${PWD}/.python-version)
|
||||||
1.8.7
|
2.7.6
|
||||||
OUT
|
OUT
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,21 +18,21 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "set by PYENV_VERSION" {
|
@test "set by PYENV_VERSION" {
|
||||||
create_version "1.9.3"
|
create_version "3.3.3"
|
||||||
PYENV_VERSION=1.9.3 run pyenv-version
|
PYENV_VERSION=3.3.3 run pyenv-version
|
||||||
assert_success "1.9.3 (set by PYENV_VERSION environment variable)"
|
assert_success "3.3.3 (set by PYENV_VERSION environment variable)"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "set by local file" {
|
@test "set by local file" {
|
||||||
create_version "1.9.3"
|
create_version "3.3.3"
|
||||||
cat > ".python-version" <<<"1.9.3"
|
cat > ".python-version" <<<"3.3.3"
|
||||||
run pyenv-version
|
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" {
|
@test "set by global file" {
|
||||||
create_version "1.9.3"
|
create_version "3.3.3"
|
||||||
cat > "${PYENV_ROOT}/version" <<<"1.9.3"
|
cat > "${PYENV_ROOT}/version" <<<"3.3.3"
|
||||||
run pyenv-version
|
run pyenv-version
|
||||||
assert_success "1.9.3 (set by ${PYENV_ROOT}/version)"
|
assert_success "3.3.3 (set by ${PYENV_ROOT}/version)"
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,84 +32,84 @@ stub_system_python() {
|
||||||
|
|
||||||
@test "single version installed" {
|
@test "single version installed" {
|
||||||
stub_system_python
|
stub_system_python
|
||||||
create_version "1.9"
|
create_version "3.3"
|
||||||
run pyenv-versions
|
run pyenv-versions
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
* system (set by ${PYENV_ROOT}/version)
|
* system (set by ${PYENV_ROOT}/version)
|
||||||
1.9
|
3.3
|
||||||
OUT
|
OUT
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "single version bare" {
|
@test "single version bare" {
|
||||||
create_version "1.9"
|
create_version "3.3"
|
||||||
run pyenv-versions --bare
|
run pyenv-versions --bare
|
||||||
assert_success "1.9"
|
assert_success "3.3"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "multiple versions" {
|
@test "multiple versions" {
|
||||||
stub_system_python
|
stub_system_python
|
||||||
create_version "1.8.7"
|
create_version "2.7.6"
|
||||||
create_version "1.9.3"
|
create_version "3.3.3"
|
||||||
create_version "2.0.0"
|
create_version "3.4.0"
|
||||||
run pyenv-versions
|
run pyenv-versions
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
* system (set by ${PYENV_ROOT}/version)
|
* system (set by ${PYENV_ROOT}/version)
|
||||||
1.8.7
|
2.7.6
|
||||||
1.9.3
|
3.3.3
|
||||||
2.0.0
|
3.4.0
|
||||||
OUT
|
OUT
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "indicates current version" {
|
@test "indicates current version" {
|
||||||
stub_system_python
|
stub_system_python
|
||||||
create_version "1.9.3"
|
create_version "3.3.3"
|
||||||
create_version "2.0.0"
|
create_version "3.4.0"
|
||||||
PYENV_VERSION=1.9.3 run pyenv-versions
|
PYENV_VERSION=3.3.3 run pyenv-versions
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
system
|
system
|
||||||
* 1.9.3 (set by PYENV_VERSION environment variable)
|
* 3.3.3 (set by PYENV_VERSION environment variable)
|
||||||
2.0.0
|
3.4.0
|
||||||
OUT
|
OUT
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "bare doesn't indicate current version" {
|
@test "bare doesn't indicate current version" {
|
||||||
create_version "1.9.3"
|
create_version "3.3.3"
|
||||||
create_version "2.0.0"
|
create_version "3.4.0"
|
||||||
PYENV_VERSION=1.9.3 run pyenv-versions --bare
|
PYENV_VERSION=3.3.3 run pyenv-versions --bare
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
1.9.3
|
3.3.3
|
||||||
2.0.0
|
3.4.0
|
||||||
OUT
|
OUT
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "globally selected version" {
|
@test "globally selected version" {
|
||||||
stub_system_python
|
stub_system_python
|
||||||
create_version "1.9.3"
|
create_version "3.3.3"
|
||||||
create_version "2.0.0"
|
create_version "3.4.0"
|
||||||
cat > "${PYENV_ROOT}/version" <<<"1.9.3"
|
cat > "${PYENV_ROOT}/version" <<<"3.3.3"
|
||||||
run pyenv-versions
|
run pyenv-versions
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
system
|
system
|
||||||
* 1.9.3 (set by ${PYENV_ROOT}/version)
|
* 3.3.3 (set by ${PYENV_ROOT}/version)
|
||||||
2.0.0
|
3.4.0
|
||||||
OUT
|
OUT
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "per-project version" {
|
@test "per-project version" {
|
||||||
stub_system_python
|
stub_system_python
|
||||||
create_version "1.9.3"
|
create_version "3.3.3"
|
||||||
create_version "2.0.0"
|
create_version "3.4.0"
|
||||||
cat > ".python-version" <<<"1.9.3"
|
cat > ".python-version" <<<"3.3.3"
|
||||||
run pyenv-versions
|
run pyenv-versions
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
system
|
system
|
||||||
* 1.9.3 (set by ${PYENV_TEST_DIR}/.python-version)
|
* 3.3.3 (set by ${PYENV_TEST_DIR}/.python-version)
|
||||||
2.0.0
|
3.4.0
|
||||||
OUT
|
OUT
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,21 +10,21 @@ create_executable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "finds versions where present" {
|
@test "finds versions where present" {
|
||||||
create_executable "1.8" "python"
|
create_executable "2.7" "python"
|
||||||
create_executable "1.8" "rake"
|
create_executable "2.7" "fab"
|
||||||
create_executable "2.0" "python"
|
create_executable "3.4" "python"
|
||||||
create_executable "2.0" "rspec"
|
create_executable "3.4" "py.test"
|
||||||
|
|
||||||
run pyenv-whence python
|
run pyenv-whence python
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
1.8
|
2.7
|
||||||
2.0
|
3.4
|
||||||
OUT
|
OUT
|
||||||
|
|
||||||
run pyenv-whence rake
|
run pyenv-whence fab
|
||||||
assert_success "1.8"
|
assert_success "2.7"
|
||||||
|
|
||||||
run pyenv-whence rspec
|
run pyenv-whence py.test
|
||||||
assert_success "2.0"
|
assert_success "3.4"
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,14 +13,14 @@ create_executable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "outputs path to executable" {
|
@test "outputs path to executable" {
|
||||||
create_executable "1.8" "python"
|
create_executable "2.7" "python"
|
||||||
create_executable "2.0" "rspec"
|
create_executable "3.4" "py.test"
|
||||||
|
|
||||||
PYENV_VERSION=1.8 run pyenv-which python
|
PYENV_VERSION=2.7 run pyenv-which python
|
||||||
assert_success "${PYENV_ROOT}/versions/1.8/bin/python"
|
assert_success "${PYENV_ROOT}/versions/2.7/bin/python"
|
||||||
|
|
||||||
PYENV_VERSION=2.0 run pyenv-which rspec
|
PYENV_VERSION=3.4 run pyenv-which py.test
|
||||||
assert_success "${PYENV_ROOT}/versions/2.0/bin/rspec"
|
assert_success "${PYENV_ROOT}/versions/3.4/bin/py.test"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "searches PATH for system version" {
|
@test "searches PATH for system version" {
|
||||||
|
@ -32,30 +32,30 @@ create_executable() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "version not installed" {
|
@test "version not installed" {
|
||||||
create_executable "2.0" "rspec"
|
create_executable "3.4" "py.test"
|
||||||
PYENV_VERSION=1.9 run pyenv-which rspec
|
PYENV_VERSION=3.3 run pyenv-which py.test
|
||||||
assert_failure "pyenv: version \`1.9' is not installed"
|
assert_failure "pyenv: version \`3.3' is not installed"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "no executable found" {
|
@test "no executable found" {
|
||||||
create_executable "1.8" "rspec"
|
create_executable "2.7" "py.test"
|
||||||
PYENV_VERSION=1.8 run pyenv-which rake
|
PYENV_VERSION=2.7 run pyenv-which fab
|
||||||
assert_failure "pyenv: rake: command not found"
|
assert_failure "pyenv: fab: command not found"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "executable found in other versions" {
|
@test "executable found in other versions" {
|
||||||
create_executable "1.8" "python"
|
create_executable "2.7" "python"
|
||||||
create_executable "1.9" "rspec"
|
create_executable "3.3" "py.test"
|
||||||
create_executable "2.0" "rspec"
|
create_executable "3.4" "py.test"
|
||||||
|
|
||||||
PYENV_VERSION=1.8 run pyenv-which rspec
|
PYENV_VERSION=2.7 run pyenv-which py.test
|
||||||
assert_failure
|
assert_failure
|
||||||
assert_output <<OUT
|
assert_output <<OUT
|
||||||
pyenv: rspec: command not found
|
pyenv: py.test: command not found
|
||||||
|
|
||||||
The \`rspec' command exists in these Python versions:
|
The \`py.test' command exists in these Python versions:
|
||||||
1.9
|
3.3
|
||||||
2.0
|
3.4
|
||||||
OUT
|
OUT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue