@@ -22,7 +22,7 @@ setUp () {
22
22
}
23
23
24
24
test_create () {
25
- mkvirtualenv " env1"
25
+ mkvirtualenv " env1" > /dev/null 2>&1
26
26
assertTrue " Environment directory was not created" " [ -d $WORKON_HOME /env1 ]"
27
27
for hook in postactivate predeactivate postdeactivate
28
28
do
@@ -32,7 +32,7 @@ test_create() {
32
32
}
33
33
34
34
test_activates () {
35
- mkvirtualenv " env2"
35
+ mkvirtualenv " env2" > /dev/null 2>&1
36
36
assertTrue virtualenvwrapper_verify_active_environment
37
37
assertSame " env2" $( basename " $VIRTUAL_ENV " )
38
38
}
@@ -45,7 +45,7 @@ test_hooks () {
45
45
chmod +x " $WORKON_HOME /premkvirtualenv"
46
46
47
47
echo " echo GLOBAL postmkvirtualenv >> $test_dir /catch_output" > " $WORKON_HOME /postmkvirtualenv"
48
- mkvirtualenv " env3"
48
+ mkvirtualenv " env3" > /dev/null 2>&1
49
49
output=$( cat " $test_dir /catch_output" )
50
50
workon_home_as_pwd=$( cd $WORKON_HOME ; pwd)
51
51
expected=" GLOBAL premkvirtualenv $workon_home_as_pwd env3
@@ -86,6 +86,33 @@ test_no_workon_home () {
86
86
WORKON_HOME=" $old_home "
87
87
}
88
88
89
+ test_mkvirtualenv_sitepackages () {
90
+ # This part of the test is not reliable because
91
+ # creating a new virtualenv from inside the
92
+ # tox virtualenv inherits the setting from there.
93
+ # # Without the option, verify that site-packages are copied.
94
+ # mkvirtualenv "with_sp" >/dev/null 2>&1
95
+ # ngsp_file="`virtualenvwrapper_get_site_packages_dir`/../no-global-site-packages.txt"
96
+ # assertFalse "$ngsp_file exists" "[ -f \"$ngsp_file\" ]"
97
+ # rmvirtualenv "env3"
98
+
99
+ # With the argument, verify that they are not copied.
100
+ mkvirtualenv --no-site-packages " without_sp" > /dev/null 2>&1
101
+ ngsp_file=" ` virtualenvwrapper_get_site_packages_dir` /../no-global-site-packages.txt"
102
+ assertTrue " $ngsp_file does not exist" " [ -f \" $ngsp_file \" ]"
103
+ rmvirtualenv " env4"
104
+ }
105
+
106
+ test_mkvirtualenv_args () {
107
+ VIRTUALENVWRAPPER_VIRTUALENV_ARGS=" --no-site-packages"
108
+ # With the argument, verify that they are not copied.
109
+ mkvirtualenv " without_sp2" > /dev/null 2>&1
110
+ ngsp_file=" ` virtualenvwrapper_get_site_packages_dir` /../no-global-site-packages.txt"
111
+ assertTrue " $ngsp_file does not exist" " [ -f \" $ngsp_file \" ]"
112
+ rmvirtualenv " env4"
113
+ unset VIRTUALENVWRAPPER_VIRTUALENV_ARGS
114
+ }
115
+
89
116
test_virtualenv_fails () {
90
117
# Test to reproduce the conditions in issue #76
91
118
# https://bitbucket.org/dhellmann/virtualenvwrapper/issue/76/
@@ -103,7 +130,7 @@ test_virtualenv_fails () {
103
130
chmod +x " $WORKON_HOME /premkvirtualenv"
104
131
105
132
echo " echo GLOBAL postmkvirtualenv >> $test_dir /catch_output" > " $WORKON_HOME /postmkvirtualenv"
106
- mkvirtualenv " env3"
133
+ mkvirtualenv " env3" > /dev/null 2>&1
107
134
output=$( cat " $test_dir /catch_output" 2> /dev/null)
108
135
workon_home_as_pwd=$( cd $WORKON_HOME ; pwd)
109
136
expected=" "
@@ -114,26 +141,5 @@ test_virtualenv_fails () {
114
141
VIRTUALENVWRAPPER_VIRTUALENV=virtualenv
115
142
}
116
143
117
- # test_mkvirtualenv_sitepackages () {
118
- # # Without the option verify that site-packages are copied.
119
- # mkvirtualenv "env3"
120
- # assertSame "env3" "$(basename $VIRTUAL_ENV)"
121
- # pyvers=$(python -V 2>&1 | cut -f2 -d' ' | cut -f1-2 -d.)
122
- # sitepackages="$VIRTUAL_ENV/lib/python${pyvers}/site-packages"
123
- # #cat "$sitepackages/easy-install.pth"
124
- # assertTrue "Do not have expected virtualenv.py" "[ -f $sitepackages/virtualenv.py ]"
125
- # rmvirtualenv "env3"
126
- #
127
- # # With the argument, verify that they are not copied.
128
- # mkvirtualenv --no-site-packages "env4"
129
- # assertSame "env4" $(basename "$VIRTUAL_ENV")
130
- # pyvers=$(python -V 2>&1 | cut -f2 -d' ' | cut -f1-2 -d.)
131
- # sitepackages="$VIRTUAL_ENV/lib/python${pyvers}/site-packages"
132
- # assertTrue "[ -f $sitepackages/setuptools.pth ]"
133
- # assertTrue "[ -f $sitepackages/easy-install.pth ]"
134
- # assertFalse "Have virtualenv.py but should not" "[ -f $sitepackages/virtualenv.py ]"
135
- # rmvirtualenv "env4"
136
- # }
137
-
138
144
139
145
. " $test_dir /shunit2"
0 commit comments