@@ -22,7 +22,7 @@ setUp () {
2222}
2323
2424test_create () {
25- mkvirtualenv " env1"
25+ mkvirtualenv " env1" > /dev/null 2>&1
2626 assertTrue " Environment directory was not created" " [ -d $WORKON_HOME /env1 ]"
2727 for hook in postactivate predeactivate postdeactivate
2828 do
@@ -32,7 +32,7 @@ test_create() {
3232}
3333
3434test_activates () {
35- mkvirtualenv " env2"
35+ mkvirtualenv " env2" > /dev/null 2>&1
3636 assertTrue virtualenvwrapper_verify_active_environment
3737 assertSame " env2" $( basename " $VIRTUAL_ENV " )
3838}
@@ -45,7 +45,7 @@ test_hooks () {
4545 chmod +x " $WORKON_HOME /premkvirtualenv"
4646
4747 echo " echo GLOBAL postmkvirtualenv >> $test_dir /catch_output" > " $WORKON_HOME /postmkvirtualenv"
48- mkvirtualenv " env3"
48+ mkvirtualenv " env3" > /dev/null 2>&1
4949 output=$( cat " $test_dir /catch_output" )
5050 workon_home_as_pwd=$( cd $WORKON_HOME ; pwd)
5151 expected=" GLOBAL premkvirtualenv $workon_home_as_pwd env3
@@ -86,6 +86,33 @@ test_no_workon_home () {
8686 WORKON_HOME=" $old_home "
8787}
8888
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+
89116test_virtualenv_fails () {
90117 # Test to reproduce the conditions in issue #76
91118 # https://bitbucket.org/dhellmann/virtualenvwrapper/issue/76/
@@ -103,7 +130,7 @@ test_virtualenv_fails () {
103130 chmod +x " $WORKON_HOME /premkvirtualenv"
104131
105132 echo " echo GLOBAL postmkvirtualenv >> $test_dir /catch_output" > " $WORKON_HOME /postmkvirtualenv"
106- mkvirtualenv " env3"
133+ mkvirtualenv " env3" > /dev/null 2>&1
107134 output=$( cat " $test_dir /catch_output" 2> /dev/null)
108135 workon_home_as_pwd=$( cd $WORKON_HOME ; pwd)
109136 expected=" "
@@ -114,26 +141,5 @@ test_virtualenv_fails () {
114141 VIRTUALENVWRAPPER_VIRTUALENV=virtualenv
115142}
116143
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-
138144
139145. " $test_dir /shunit2"
0 commit comments