pyenv/test/global.bats
Ivan Pozdeev 74c6efe2f4 Adapt tests involving current directory for Docker
In Docker CI tests, the default current dir is read-only
2026-07-11 08:02:53 +03:00

40 lines
820 B
Bash

#!/usr/bin/env bats
load test_helper
@test "default" {
run pyenv-global
assert_success
assert_output "system"
}
@test "read PYENV_ROOT/version" {
mkdir -p "$PYENV_ROOT"
echo "1.2.3" > "$PYENV_ROOT/version"
run pyenv-global
assert_success
assert_output "1.2.3"
}
@test "version with glob characters is handled correctly" {
cd "$BATS_TEST_TMPDIR"; touch 1.1
mkdir -p "$PYENV_ROOT"
echo "[1-9].?*" > "$PYENV_ROOT/version"
run pyenv-global
assert_success "[1-9].?*"
}
@test "set PYENV_ROOT/version" {
mkdir -p "$PYENV_ROOT/versions/1.2.3"
run pyenv-global "1.2.3"
assert_success
run pyenv-global
assert_success "1.2.3"
}
@test "fail setting invalid PYENV_ROOT/version" {
mkdir -p "$PYENV_ROOT"
run pyenv-global "1.2.3"
assert_failure "pyenv: version \`1.2.3' not installed"
}