1. Doug Hellmann
  2. virtualenvwrapper

Commits

Doug Hellmann  committed dc96568 Merge

merge in linux changes

  • Participants
  • Parent commits 4090c2d, 1eed635
  • Branches master

Comments (0)

Files changed (3)

File .hgignore

View file
 syntax: glob
+*~
 *.pyc
 README.html
 build

File tests/run_tests

View file
 
 # Run the test scripts with a little formatting around them to make it
 # easier to find where each script output starts.
-for test_shell in bash ksh zsh
+for test_script in $scripts
 do
-    test_shell_opts=
-    if [ $test_shell = "zsh" ]; then
-        test_shell_opts="-o shwordsplit"
-    fi
-    test_shell=$(which $test_shell)
 
-    for test_script in $scripts
+    for test_shell in bash ksh zsh
     do
+	test_shell_opts=
+	if [ $test_shell = "zsh" ]; then
+            test_shell_opts="-o shwordsplit"
+	fi
+	export test_shell=$(which $test_shell)
+
         echo
         echo '********************************************************************************'
         echo "Running $test_script"

File tests/test.sh

View file
 }
 
 test_virtualenvwrapper_initialize() {
-    virtualenvwrapper_initialize
+    assertTrue "Initialized" virtualenvwrapper_initialize
     for hook in premkvirtualenv postmkvirtualenv prermvirtualenv postrmvirtualenv preactivate postactivate predeactivate postdeactivate
     do
-        assertTrue "Global $hook was not created" "[ -f $WORKON_HOME/$hook ]"
-        assertTrue "Global $hook is not executable" "[ -x $WORKON_HOME/$hook ]"
+        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)
     cd "$WORKON_HOME"
     mkvirtualenv --no-site-packages no_wrappers
     expected="ImportError: No module named virtualenvwrapper.hook_loader"
-    output=$(VIRTUALENVWRAPPER_PYTHON=$(which python) $SHELL $return_to/virtualenvwrapper.sh 2>&1)
-    echo "$output" | grep -q "$expected" 2>&1
-    found=$?
-    assertTrue "Expected \"$expected\", got: \"$output\"" "[ $found -eq 0 ]"
+    # test_shell is set by tests/run_tests
+    if [ "$test_shell" = "" ]
+    then
+	export test_shell=$SHELL
+    fi
+    subshell_output=$(VIRTUALENVWRAPPER_PYTHON="$WORKON_HOME/no_wrappers/bin/python" $test_shell -x $return_to/virtualenvwrapper.sh 2>&1)
+    echo "$subshell_output"
+    echo "$subshell_output" | grep -q "$expected" 2>&1
+    found_it=$?
+    echo "$found_it"
+    assertTrue "Expected \'$expected\', got: \'$subshell_output\'" "[ $found_it -eq 0 ]"
     assertFalse "Failed to detect invalid Python location" "VIRTUALENVWRAPPER_PYTHON=$VIRTUAL_ENV/bin/python $SHELL $return_to/virtualenvwrapper.sh >/dev/null 2>&1"
     cd "$return_to"
     deactivate