@@ -9,7 +9,7 @@ export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
99oneTimeSetUp () {
1010 rm -rf " $WORKON_HOME "
1111 mkdir -p " $WORKON_HOME "
12- source " $test_dir /../virtualenvwrapper.sh"
12+ source " $test_dir /../virtualenvwrapper.sh" > /dev/null 2>&1
1313}
1414
1515oneTimeTearDown () {
@@ -41,7 +41,7 @@ test_add2virtualenv () {
4141}
4242
4343test_add2virtualenv_relative () {
44- mkvirtualenv " pathtest " > /dev/null 2>&1
44+ mkvirtualenv " pathtest_relative " > /dev/null 2>&1
4545 parent_dir=$( dirname $( pwd) )
4646 base_dir=$( basename $( pwd) )
4747 add2virtualenv " ../$base_dir "
@@ -51,18 +51,70 @@ test_add2virtualenv_relative () {
5151 cd - > /dev/null 2>&1
5252}
5353
54+ test_add2virtualenv_space () {
55+ # see #132
56+ mkvirtualenv " pathtest_space" > /dev/null 2>&1
57+ parent_dir=$( dirname $( pwd) )
58+ cdvirtualenv
59+ mkdir ' a b'
60+ add2virtualenv ' a b'
61+ cdsitepackages
62+ path_file=" ./_virtualenv_path_extensions.pth"
63+ assertTrue " No 'a b' in \" ` cat $path_file ` \" " " grep -q 'a b' $path_file "
64+ cd - > /dev/null 2>&1
65+ }
66+
67+ test_add2virtualenv_ampersand () {
68+ # see #132
69+ mkvirtualenv " pathtest_ampersand" > /dev/null 2>&1
70+ parent_dir=$( dirname $( pwd) )
71+ cdvirtualenv
72+ mkdir ' a & b'
73+ add2virtualenv ' a & b'
74+ cdsitepackages
75+ path_file=" ./_virtualenv_path_extensions.pth"
76+ assertTrue " No 'a & b' in \" ` cat $path_file ` \" " " grep -q 'a & b' $path_file "
77+ cd - > /dev/null 2>&1
78+ }
79+
5480test_add2virtualenv_delete () {
5581 path_file=" ./_virtualenv_path_extensions.pth"
56- mkvirtualenv " pathtest " > /dev/null 2>&1
82+ mkvirtualenv " pathtest_delete " > /dev/null 2>&1
5783 cdsitepackages
5884 # Make sure it was added
5985 add2virtualenv " /full/path"
60- assertTrue " No $full_path in $( cat $path_file ) " " grep -q $full_path $path_file "
86+ assertTrue " No /full/path in $( cat $path_file ) " " grep -q /full/path $path_file "
6187 # Remove it and verify that change
6288 add2virtualenv -d " /full/path"
6389 assertFalse " /full/path in ` cat $path_file ` " " grep -q /full/path $path_file "
6490 cd - > /dev/null 2>&1
6591}
6692
93+ test_add2virtualenv_delete_space () {
94+ path_file=" ./_virtualenv_path_extensions.pth"
95+ mkvirtualenv " pathtest_delete_space" > /dev/null 2>&1
96+ cdsitepackages
97+ # Make sure it was added
98+ add2virtualenv " /full/path with spaces"
99+ assertTrue " No /full/path with spaces in $( cat $path_file ) " " grep -q '/full/path with spaces' $path_file "
100+ # Remove it and verify that change
101+ add2virtualenv -d " /full/path with spaces"
102+ assertFalse " /full/path with spaces in ` cat $path_file ` " " grep -q '/full/path with spaces' $path_file "
103+ cd - > /dev/null 2>&1
104+ }
105+
106+ test_add2virtualenv_delete_ampersand () {
107+ path_file=" ./_virtualenv_path_extensions.pth"
108+ mkvirtualenv " pathtest_delete_ampersand" > /dev/null 2>&1
109+ cdsitepackages
110+ # Make sure it was added
111+ add2virtualenv " /full/path & dir"
112+ assertTrue " No /full/path & dir in $( cat $path_file ) " " grep -q '/full/path & dir' $path_file "
113+ # Remove it and verify that change
114+ add2virtualenv -d " /full/path & dir"
115+ assertFalse " /full/path & dir in ` cat $path_file ` " " grep -q '/full/path & dir' $path_file "
116+ cd - > /dev/null 2>&1
117+ }
118+
67119
68120. " $test_dir /shunit2"
0 commit comments