Skip to content

Commit dd6ecc7

Browse files
committed
variable name changes and other cleanup so the script does not bomb under ksh on ubunutu 11.04
1 parent 0db6911 commit dd6ecc7

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

tests/test.sh

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ setUp () {
2222
}
2323

2424
test_virtualenvwrapper_initialize() {
25-
virtualenvwrapper_initialize
25+
assertTrue "Initialized" virtualenvwrapper_initialize
2626
for hook in premkvirtualenv postmkvirtualenv prermvirtualenv postrmvirtualenv preactivate postactivate predeactivate postdeactivate
2727
do
28-
assertTrue "Global $hook was not created" "[ -f $WORKON_HOME/$hook ]"
29-
assertTrue "Global $hook is not executable" "[ -x $WORKON_HOME/$hook ]"
28+
assertTrue "Global $WORKON_HOME/$hook was not created" "[ -f $WORKON_HOME/$hook ]"
29+
assertTrue "Global $WORKON_HOME/$hook is not executable" "[ -x $WORKON_HOME/$hook ]"
3030
done
3131
assertTrue "Log file was not created" "[ -f $WORKON_HOME/hook.log ]"
3232
export pre_test_dir=$(cd "$test_dir"; pwd)
@@ -94,10 +94,17 @@ test_python_interpreter_set_incorrectly() {
9494
cd "$WORKON_HOME"
9595
mkvirtualenv --no-site-packages no_wrappers
9696
expected="ImportError: No module named virtualenvwrapper.hook_loader"
97-
output=$(VIRTUALENVWRAPPER_PYTHON=$(which python) $SHELL $return_to/virtualenvwrapper.sh 2>&1)
98-
echo "$output" | grep -q "$expected" 2>&1
99-
found=$?
100-
assertTrue "Expected \"$expected\", got: \"$output\"" "[ $found -eq 0 ]"
97+
# test_shell is set by tests/run_tests
98+
if [ "$test_shell" = "" ]
99+
then
100+
export test_shell=$SHELL
101+
fi
102+
subshell_output=$(VIRTUALENVWRAPPER_PYTHON="$WORKON_HOME/no_wrappers/bin/python" $test_shell -x $return_to/virtualenvwrapper.sh 2>&1)
103+
echo "$subshell_output"
104+
echo "$subshell_output" | grep -q "$expected" 2>&1
105+
found_it=$?
106+
echo "$found_it"
107+
assertTrue "Expected \'$expected\', got: \'$subshell_output\'" "[ $found_it -eq 0 ]"
101108
assertFalse "Failed to detect invalid Python location" "VIRTUALENVWRAPPER_PYTHON=$VIRTUAL_ENV/bin/python $SHELL $return_to/virtualenvwrapper.sh >/dev/null 2>&1"
102109
cd "$return_to"
103110
deactivate

0 commit comments

Comments
 (0)