1# -*- mode: shell-script -*- 2 3test_dir=$(cd $(dirname $0) && pwd) 4source "$test_dir/setup.sh" 5 6setUp () { 7 rm -rf "$WORKON_HOME" 8 mkdir -p "$WORKON_HOME" 9 source "$test_dir/../virtualenvwrapper.sh" 10 echo 11} 12 13tearDown() { 14 if type deactivate >/dev/null 2>&1 15 then 16 deactivate 17 fi 18 rm -rf "$WORKON_HOME" 19} 20 21test_wipeenv () { 22 mkvirtualenv "wipetest" >/dev/null 2>&1 23 (cd tests/testpackage && python setup.py install) >/dev/null 2>&1 24 before="$(pip freeze)" 25 assertTrue "testpackage not installed" "pip freeze | grep testpackage" 26 wipeenv >/dev/null 2>&1 27 after="$(pip freeze)" 28 assertFalse "testpackage still installed" "pip freeze | grep testpackage" 29} 30 31test_wipeenv_pip_e () { 32 mkvirtualenv "wipetest" >/dev/null 2>&1 33 (cd tests/testpackage && pip install -e .) >/dev/null 2>&1 34 before="$(pip freeze)" 35 assertTrue "testpackage not installed" "pip freeze | grep testpackage" 36 wipeenv >/dev/null 2>&1 37 after="$(pip freeze)" 38 assertFalse "testpackage still installed" "pip freeze | grep testpackage" 39} 40 41# test_wipeenv_pip_e_url () { 42# mkvirtualenv "wipetest" >/dev/null 2>&1 43# (cd tests/testpackage && pip install -e 'git+https://github.com/kennethreitz/legit.git@3c4d3214811c7892edf903682fdbb44f4050b99a#egg=legit-origin') 44# # >/dev/null 2>&1 45# before="$(pip freeze)" 46# pip freeze 47# assertTrue "legit not installed" "pip freeze | grep legit" 48# wipeenv >/dev/null 2>&1 49# after="$(pip freeze)" 50# assertFalse "legit still installed" "pip freeze | grep legit" 51# } 52 53test_wipeenv_develop () { 54 mkvirtualenv "wipetest" >/dev/null 2>&1 55 (cd tests/testpackage && python setup.py develop) >/dev/null 2>&1 56 before="$(pip freeze)" 57 assertTrue "testpackage not installed" "pip freeze | grep testpackage" 58 wipeenv >/dev/null 2>&1 59 after="$(pip freeze)" 60 assertFalse "testpackage still installed" "pip freeze | grep testpackage" 61} 62 63test_empty_env () { 64 mkvirtualenv "wipetest" >/dev/null 2>&1 65 before="$(pip freeze)" 66 assertFalse "testpackage still installed" "pip freeze | grep testpackage" 67 wipeenv >/dev/null 2>&1 68 after="$(pip freeze)" 69 assertFalse "testpackage still installed" "pip freeze | grep testpackage" 70} 71 72test_not_active_env () { 73 mkvirtualenv "wipetest" >/dev/null 2>&1 74 deactivate 75 assertFalse "wipenv did not report an error" "wipeenv >/dev/null 2>&1" 76} 77 78. "$test_dir/shunit2" 79 80