Commits

Doug Hellmann committed ba2c4ea

add test for mkvirtualenv w/ site-packages

Ensure that if the --system-site-packages option
is passed properly, the new virtualenv is activated.

Fixes issue #189

Signed-off-by: Doug Hellmann <doug.hellmann@gmail.com>

Comments (0)

Files changed (1)

tests/test_mkvirtualenv.sh

     rm -f "$WORKON_HOME/premkvirtualenv"
     rm -f "$WORKON_HOME/postmkvirtualenv"
     deactivate
-    rmvirtualenv "env3"
+    rmvirtualenv "env3" >/dev/null 2>&1
 }
 
 test_no_virtualenv () {
     rmvirtualenv "env4"
 }
 
+test_mkvirtualenv_hooks_system_site_packages () {
+    # See issue #189
+
+    export pre_test_dir=$(cd "$test_dir"; pwd)
+
+    echo "#!/bin/sh" > "$WORKON_HOME/premkvirtualenv"
+    echo "echo GLOBAL premkvirtualenv \`pwd\` \"\$@\" >> \"$pre_test_dir/catch_output\"" >> "$WORKON_HOME/premkvirtualenv"
+    chmod +x "$WORKON_HOME/premkvirtualenv"
+
+    echo "echo GLOBAL postmkvirtualenv >> $test_dir/catch_output" > "$WORKON_HOME/postmkvirtualenv"
+    mkvirtualenv --system-site-packages "env189" >/dev/null 2>&1
+    output=$(cat "$test_dir/catch_output")
+    workon_home_as_pwd=$(cd $WORKON_HOME; pwd)
+    expected="GLOBAL premkvirtualenv $workon_home_as_pwd env189
+GLOBAL postmkvirtualenv"
+    assertSame "$expected" "$output"
+    rm -f "$WORKON_HOME/premkvirtualenv"
+    rm -f "$WORKON_HOME/postmkvirtualenv"
+    deactivate
+    rmvirtualenv "env189" >/dev/null 2>&1
+}
+
 test_mkvirtualenv_args () {
     # See issue #102
     VIRTUALENVWRAPPER_VIRTUALENV_ARGS="--no-site-packages"