mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-14 06:23:52 -05:00
Add tests for extra envs in PYENV_ROOT
This commit is contained in:
46
test/envs.bats
Normal file
46
test/envs.bats
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
setup() {
|
||||
export PYENV_ROOT="${TMP}/envs/pyenv"
|
||||
}
|
||||
|
||||
stub_pyenv() {
|
||||
stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'"
|
||||
stub pyenv-hooks "virtualenv : echo"
|
||||
stub pyenv-rehash " : echo rehashed"
|
||||
}
|
||||
|
||||
unstub_pyenv() {
|
||||
unstub pyenv-prefix
|
||||
unstub pyenv-hooks
|
||||
unstub pyenv-rehash
|
||||
}
|
||||
|
||||
@test "path should be handled properly even if there is 'envs' in PYENV_ROOT" {
|
||||
export PYENV_VERSION="3.4.1"
|
||||
setup_pyvenv "3.4.1"
|
||||
stub_pyenv "${PYENV_VERSION}"
|
||||
stub pyenv-version-name "echo '${PYENV_VERSION}'"
|
||||
stub pyenv-prefix " : echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'"
|
||||
stub pyenv-virtualenv-prefix " : false"
|
||||
stub pyenv-exec "pyvenv * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";mkdir -p \${PYENV_ROOT}/versions/3.4.1/envs/venv/bin"
|
||||
stub pyenv-exec "python -s -m ensurepip : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\";touch \${PYENV_ROOT}/versions/3.4.1/envs/venv/bin/pip"
|
||||
|
||||
run pyenv-virtualenv venv
|
||||
|
||||
assert_success
|
||||
assert_output <<OUT
|
||||
PYENV_VERSION=3.4.1 pyvenv ${PYENV_ROOT}/versions/3.4.1/envs/venv
|
||||
PYENV_VERSION=3.4.1/envs/venv python -s -m ensurepip
|
||||
rehashed
|
||||
OUT
|
||||
assert [ -e "${PYENV_ROOT}/versions/3.4.1/envs/venv/bin/pip" ]
|
||||
|
||||
unstub_pyenv
|
||||
unstub pyenv-version-name
|
||||
unstub pyenv-virtualenv-prefix
|
||||
unstub pyenv-exec
|
||||
teardown_pyvenv "3.4.1"
|
||||
}
|
||||
Reference in New Issue
Block a user