@@ -23,10 +23,17 @@ setUp () {
23
23
24
24
test_add2virtualenv () {
25
25
mkvirtualenv " pathtest"
26
- add2virtualenv " /full/path"
26
+ full_path=$( pwd)
27
+ add2virtualenv " $full_path "
27
28
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 "
30
37
cd -
31
38
}
32
39
@@ -36,10 +43,21 @@ test_add2virtualenv_relative () {
36
43
base_dir=$( basename $( pwd) )
37
44
add2virtualenv " ../$base_dir "
38
45
cdsitepackages
39
- path_file=" ./virtualenv_path_extensions .pth"
46
+ path_file=" ./_virtualenv_path_extensions .pth"
40
47
assertTrue " No $parent_dir /$base_dir in \" ` cat $path_file ` \" " " grep \" $parent_dir /$base_dir \" $path_file "
41
48
cd - > /dev/null 2>&1
42
49
}
43
50
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
+
44
62
45
63
. " $test_dir /shunit2"
0 commit comments