1. Doug Hellmann
  2. virtualenvwrapper

Commits

Thomas Desvenain  committed 0f467ce

added test that copied virtualenv exists

  • Participants
  • Parent commits fd037ad
  • Branches master

Comments (0)

Files changed (2)

File tests/test_cp.sh

View file
  • Ignore whitespace
     assertSame "$VIRTUAL_ENV" "$(pwd)"
 }
 
+test_cp_notexists () {
+    out="$(cpvirtualenv virtualenvthatdoesntexist foo)"
+    assertSame "$out" "virtualenvthatdoesntexist virtualenv doesn't exist"
+}
 
 . "$test_dir/shunit2"
 

File virtualenvwrapper_bashrc

View file
  • Ignore whitespace
         echo "Please specify target virtualenv"
         return 1
     fi
-    if [echo "$WORKON_HOME" | grep -e "/$"]
+    if echo "$WORKON_HOME" | grep -e "/$"
     then
         env_home="$WORKON_HOME"
     else
     fi
     source_env="$env_home$env_name"
     target_env="$env_home$new_env"
+    
+    if [ ! -e "$source_env" ]
+    then
+        echo "$env_name virtualenv doesn't exist"
+        return 1
+    fi
 
     cp -r "$source_env" "$target_env"
     for script in $( ls $target_env/bin/* )