mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-10 04:23:53 -05:00
Add tests for virtualenv-delete
This commit is contained in:
71
test/delete.bats
Normal file
71
test/delete.bats
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
load test_helper
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
export PYENV_ROOT="${TMP}/pyenv"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "delete virtualenv" {
|
||||||
|
mkdir -p "${PYENV_ROOT}/versions/venv27"
|
||||||
|
|
||||||
|
stub pyenv-virtualenv-prefix "venv27 : true"
|
||||||
|
stub pyenv-rehash "true"
|
||||||
|
|
||||||
|
run pyenv-virtualenv-delete -f "venv27"
|
||||||
|
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
unstub pyenv-virtualenv-prefix
|
||||||
|
unstub pyenv-rehash
|
||||||
|
|
||||||
|
[ ! -d "${PYENV_ROOT}/versions/venv27" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "delete virtualenv by symlink" {
|
||||||
|
mkdir -p "${PYENV_ROOT}/versions/2.7.10/envs/venv27"
|
||||||
|
ln -fs "${PYENV_ROOT}/versions/2.7.10/envs/venv27" "${PYENV_ROOT}/versions/venv27"
|
||||||
|
|
||||||
|
stub pyenv-rehash "true"
|
||||||
|
|
||||||
|
run pyenv-virtualenv-delete -f "venv27"
|
||||||
|
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
unstub pyenv-rehash
|
||||||
|
|
||||||
|
[ ! -d "${PYENV_ROOT}/versions/2.7.10/envs/venv27" ]
|
||||||
|
[ ! -L "${PYENV_ROOT}/versions/venv27" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "delete virtualenv with symlink" {
|
||||||
|
mkdir -p "${PYENV_ROOT}/versions/2.7.10/envs/venv27"
|
||||||
|
ln -fs "${PYENV_ROOT}/versions/2.7.10/envs/venv27" "${PYENV_ROOT}/versions/venv27"
|
||||||
|
|
||||||
|
stub pyenv-rehash "true"
|
||||||
|
|
||||||
|
run pyenv-virtualenv-delete -f "2.7.10/envs/venv27"
|
||||||
|
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
unstub pyenv-rehash
|
||||||
|
|
||||||
|
[ ! -d "${PYENV_ROOT}/versions/2.7.10/envs/venv27" ]
|
||||||
|
[ ! -L "${PYENV_ROOT}/versions/venv27" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "not delete virtualenv with same name" {
|
||||||
|
mkdir -p "${PYENV_ROOT}/versions/2.7.10/envs/venv27"
|
||||||
|
mkdir -p "${PYENV_ROOT}/versions/venv27"
|
||||||
|
|
||||||
|
stub pyenv-rehash "true"
|
||||||
|
|
||||||
|
run pyenv-virtualenv-delete -f "2.7.10/envs/venv27"
|
||||||
|
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
unstub pyenv-rehash
|
||||||
|
|
||||||
|
[ ! -d "${PYENV_ROOT}/versions/2.7.10/envs/venv27" ]
|
||||||
|
[ -d "${PYENV_ROOT}/versions/venv27" ]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user