1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
#!/bin/sh
test_dir=$(cd $(dirname $0) && pwd)
source "$test_dir/setup.sh"
oneTimeSetUp() {
rm -rf "$WORKON_HOME"
mkdir -p "$WORKON_HOME"
source "$test_dir/../virtualenvwrapper_lazy.sh"
}
oneTimeTearDown() {
rm -rf "$WORKON_HOME"
}
setUp () {
echo
rm -f "$test_dir/catch_output"
}
function_defined_lazy() {
name="$1"
assertTrue "$name not defined" "type $name"
assertTrue "$name does not load virtualenvwrapper" "typeset -f $name | grep 'virtualenvwrapper_load'"
}
test_mkvirtualenv_defined_lazy() {
function_defined_lazy mkvirtualenv
}
test_rmvirtualenv_defined_lazy() {
function_defined_lazy rmvirtualenv
}
test_lsvirtualenv_defined_lazy() {
function_defined_lazy lsvirtualenv
}
test_showvirtualenv_defined_lazy() {
function_defined_lazy showvirtualenv
}
test_workon_defined_lazy() {
function_defined_lazy workon
}
test_add2virtualenv_defined_lazy() {
function_defined_lazy add2virtualenv
}
test_cdsitepackages_defined_lazy() {
function_defined_lazy cdsitepackages
}
test_cdvirtualenv_defined_lazy() {
function_defined_lazy cdvirtualenv
}
test_cdvirtualenv_defined_lazy() {
function_defined_lazy cdvirtualenv
}
test_lssitepackages_defined_lazy() {
function_defined_lazy lssitepackages
}
test_toggleglobalsitepackages_defined_lazy() {
function_defined_lazy toggleglobalsitepackages
}
test_cpvirtualenv_defined_lazy() {
function_defined_lazy cpvirtualenv
}
test_setvirtualenvproject_defined_lazy() {
function_defined_lazy setvirtualenvproject
}
test_mkproject_defined_lazy() {
function_defined_lazy mkproject
}
test_cdproject_defined_lazy() {
function_defined_lazy cdproject
}
test_mktmpenv_defined_lazy() {
function_defined_lazy mktmpenv
}
# test_virtualenvwrapper_initialize() {
# assertTrue "Initialized" virtualenvwrapper_initialize
# for hook in premkvirtualenv postmkvirtualenv prermvirtualenv postrmvirtualenv preactivate postactivate predeactivate postdeactivate
# do
# assertTrue "Global $WORKON_HOME/$hook was not created" "[ -f $WORKON_HOME/$hook ]"
# assertTrue "Global $WORKON_HOME/$hook is not executable" "[ -x $WORKON_HOME/$hook ]"
# done
# assertTrue "Log file was not created" "[ -f $WORKON_HOME/hook.log ]"
# export pre_test_dir=$(cd "$test_dir"; pwd)
# echo "echo GLOBAL initialize >> \"$pre_test_dir/catch_output\"" >> "$WORKON_HOME/initialize"
# virtualenvwrapper_initialize
# output=$(cat "$test_dir/catch_output")
# expected="GLOBAL initialize"
# assertSame "$expected" "$output"
# }
. "$test_dir/shunit2"
|