Sfoglia il codice sorgente

Add tests for `virtualenv-delete`

pull/106/head
Yamashita, Yuu 9 anni fa
parent
commit
07b31aa2f6
1 ha cambiato i file con 71 aggiunte e 0 eliminazioni
  1. +71
    -0
      test/delete.bats

+ 71
- 0
test/delete.bats Vedi 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" ]
}

Caricamento…
Annulla
Salva