mirror of
https://github.com/pyenv/pyenv.git
synced 2024-12-12 03:24:20 -05:00
38 lines
831 B
Bash
38 lines
831 B
Bash
#!/usr/bin/env bats
|
|
|
|
load test_helper
|
|
|
|
create_version() {
|
|
mkdir -p "${PYENV_ROOT}/versions/$1"
|
|
}
|
|
|
|
setup() {
|
|
mkdir -p "$PYENV_TEST_DIR"
|
|
cd "$PYENV_TEST_DIR"
|
|
}
|
|
|
|
@test "no version selected" {
|
|
assert [ ! -d "${PYENV_ROOT}/versions" ]
|
|
run pyenv-version
|
|
assert_success "system (set by ${PYENV_ROOT}/version)"
|
|
}
|
|
|
|
@test "set by PYENV_VERSION" {
|
|
create_version "3.3.3"
|
|
PYENV_VERSION=3.3.3 run pyenv-version
|
|
assert_success "3.3.3 (set by PYENV_VERSION environment variable)"
|
|
}
|
|
|
|
@test "set by local file" {
|
|
create_version "3.3.3"
|
|
cat > ".python-version" <<<"3.3.3"
|
|
run pyenv-version
|
|
assert_success "3.3.3 (set by ${PWD}/.python-version)"
|
|
}
|
|
|
|
@test "set by global file" {
|
|
create_version "3.3.3"
|
|
cat > "${PYENV_ROOT}/version" <<<"3.3.3"
|
|
run pyenv-version
|
|
assert_success "3.3.3 (set by ${PYENV_ROOT}/version)"
|
|
}
|