Skip to content

Commit 0f467ce

Browse files
author
Thomas Desvenain
committed
added test that copied virtualenv exists
1 parent fd037ad commit 0f467ce

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

tests/test_cp.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ test_cprelocatablevirtualenv () {
4949
assertSame "$VIRTUAL_ENV" "$(pwd)"
5050
}
5151

52+
test_cp_notexists () {
53+
out="$(cpvirtualenv virtualenvthatdoesntexist foo)"
54+
assertSame "$out" "virtualenvthatdoesntexist virtualenv doesn't exist"
55+
}
5256

5357
. "$test_dir/shunit2"
5458

virtualenvwrapper_bashrc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,14 +438,20 @@ function cpvirtualenv() {
438438
echo "Please specify target virtualenv"
439439
return 1
440440
fi
441-
if [echo "$WORKON_HOME" | grep -e "/$"]
441+
if echo "$WORKON_HOME" | grep -e "/$"
442442
then
443443
env_home="$WORKON_HOME"
444444
else
445445
env_home="$WORKON_HOME/"
446446
fi
447447
source_env="$env_home$env_name"
448448
target_env="$env_home$new_env"
449+
450+
if [ ! -e "$source_env" ]
451+
then
452+
echo "$env_name virtualenv doesn't exist"
453+
return 1
454+
fi
449455

450456
cp -r "$source_env" "$target_env"
451457
for script in $( ls $target_env/bin/* )

0 commit comments

Comments
 (0)