Skip to content

Commit 7b08805

Browse files
committed
Make add2virtualenv tests work again, add new test code for new features.
1 parent f58a712 commit 7b08805

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

tests/test_add2virtualenv.sh

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,17 @@ setUp () {
2323

2424
test_add2virtualenv () {
2525
mkvirtualenv "pathtest"
26-
add2virtualenv "/full/path"
26+
full_path=$(pwd)
27+
add2virtualenv "$full_path"
2728
cdsitepackages
28-
path_file="./virtualenv_path_extensions.pth"
29-
assertTrue "No /full/path in `cat $path_file`" "grep /full/path $path_file"
29+
# Check contents of path file
30+
path_file="./_virtualenv_path_extensions.pth"
31+
assertTrue "No $full_path in `cat $path_file`" "grep $full_path $path_file"
32+
assertTrue "No path insert code in `cat $path_file`" "grep sys.__egginsert $path_file"
33+
# Check the path we inserted is actually at the top
34+
expected=$full_path
35+
actual=$($WORKON_HOME/pathtest/bin/python -c "import sys; print sys.path[1]")
36+
assertSame "$expected" "$actual"
3037
cd -
3138
}
3239

@@ -36,10 +43,21 @@ test_add2virtualenv_relative () {
3643
base_dir=$(basename $(pwd))
3744
add2virtualenv "../$base_dir"
3845
cdsitepackages
39-
path_file="./virtualenv_path_extensions.pth"
46+
path_file="./_virtualenv_path_extensions.pth"
4047
assertTrue "No $parent_dir/$base_dir in \"`cat $path_file`\"" "grep \"$parent_dir/$base_dir\" $path_file"
4148
cd - >/dev/null 2>&1
4249
}
4350

51+
test_add2virtualenv_delete () {
52+
mkvirtualenv "pathtest"
53+
add2virtualenv "/full/path"
54+
add2virtualenv -d "/full/path"
55+
cdsitepackages
56+
# Check contents of path file
57+
path_file="./_virtualenv_path_extensions.pth"
58+
assertFalse "/full/path in `cat $path_file`" "grep /full/path $path_file"
59+
cd -
60+
}
61+
4462

4563
. "$test_dir/shunit2"

0 commit comments

Comments
 (0)