File tree Expand file tree Collapse file tree 3 files changed +11
-10
lines changed
Expand file tree Collapse file tree 3 files changed +11
-10
lines changed Original file line number Diff line number Diff line change 33# set -x
44
55test_dir=$( dirname $0 )
6- source " $test_dir /../virtualenvwrapper.sh"
7-
86export WORKON_HOME=" ${TMPDIR:-/ tmp} /WORKON_HOME"
97
108oneTimeSetUp () {
119 rm -rf " $WORKON_HOME "
1210 mkdir -p " $WORKON_HOME "
11+ source " $test_dir /../virtualenvwrapper.sh"
1312}
1413
1514oneTimeTearDown () {
@@ -39,12 +38,12 @@ test_activates () {
3938
4039test_hooks () {
4140 export pre_test_dir=$( cd " $test_dir " ; pwd)
42- echo " echo GLOBAL premkvirtualenv >> \" $pre_test_dir /catch_output\" " >> " $WORKON_HOME /premkvirtualenv"
41+ echo " echo GLOBAL premkvirtualenv \` pwd \` \"\$ @ \" >> \" $pre_test_dir /catch_output\" " >> " $WORKON_HOME /premkvirtualenv"
4342 chmod +x " $WORKON_HOME /premkvirtualenv"
4443 echo " echo GLOBAL postmkvirtualenv >> $test_dir /catch_output" > " $WORKON_HOME /postmkvirtualenv"
4544 mkvirtualenv " env3"
4645 output=$( cat " $test_dir /catch_output" )
47- expected=" GLOBAL premkvirtualenv
46+ expected=" GLOBAL premkvirtualenv $WORKON_HOME env3
4847GLOBAL postmkvirtualenv"
4948 assertSame " $expected " " $output "
5049 rm -f " $WORKON_HOME /premkvirtualenv"
Original file line number Diff line number Diff line change @@ -42,13 +42,15 @@ test_virtualenvwrapper_source_hook_permissions() {
4242}
4343
4444test_virtualenvwrapper_run_hook_permissions () {
45+ echo " #!/bin/sh" > " $WORKON_HOME /prermvirtualenv"
4546 echo " echo run $@ >> \" $test_dir /catch_output\" " >> " $WORKON_HOME /prermvirtualenv"
4647 chmod -x " $WORKON_HOME /prermvirtualenv"
4748 touch " $test_dir /catch_output"
48- virtualenvwrapper_run_hook " pre_rmvirtualenv" " foo"
49+ error= $( virtualenvwrapper_run_hook " pre_rmvirtualenv" " foo" 2>&1 | grep " ERROR " )
4950 output=$( cat " $test_dir /catch_output" )
5051 expected=" "
5152 assertSame " $expected " " $output "
53+ assertSame " virtualenvwrapper.user_scripts ERROR: Could not run $WORKON_HOME /prermvirtualenv. [Errno 13] Permission denied" " $error "
5254}
5355
5456. " $test_dir /shunit2"
Original file line number Diff line number Diff line change 33# set -x
44
55test_dir=$( dirname $0 )
6- source " $test_dir /../virtualenvwrapper.sh"
76
87export WORKON_HOME=" ${TMPDIR:-/ tmp} /WORKON_HOME"
98
109oneTimeSetUp () {
1110 rm -rf " $WORKON_HOME "
1211 mkdir -p " $WORKON_HOME "
12+ source " $test_dir /../virtualenvwrapper.sh"
1313 mkvirtualenv " env1"
1414}
1515
@@ -70,8 +70,8 @@ test_deactivate_hooks () {
7070
7171 for t in pre post
7272 do
73- echo " echo GLOBAL ${t} deactivate >> $test_dir /catch_output" > " $WORKON_HOME /${t} deactivate"
74- echo " echo ENV ${t} deactivate >> $test_dir /catch_output" > " $WORKON_HOME /env1/bin/${t} deactivate"
73+ echo " echo GLOBAL ${t} deactivate \$ VIRTUALENVWRAPPER_LAST_VIRTUAL_ENV >> $test_dir /catch_output" > " $WORKON_HOME /${t} deactivate"
74+ echo " echo ENV ${t} deactivate \$ VIRTUALENVWRAPPER_LAST_VIRTUAL_ENV >> $test_dir /catch_output" > " $WORKON_HOME /env1/bin/${t} deactivate"
7575 done
7676
7777 touch " $test_dir /catch_output"
@@ -81,8 +81,8 @@ test_deactivate_hooks () {
8181 output=$( cat " $test_dir /catch_output" )
8282 expected=" ENV predeactivate
8383GLOBAL predeactivate
84- ENV postdeactivate
85- GLOBAL postdeactivate"
84+ ENV postdeactivate $WORKON_HOME /env1
85+ GLOBAL postdeactivate $WORKON_HOME /env1 "
8686 assertSame " $expected " " $output "
8787
8888 for t in pre post
You can’t perform that action at this time.
0 commit comments