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 3
3
# set -x
4
4
5
5
test_dir=$( dirname $0 )
6
- source " $test_dir /../virtualenvwrapper.sh"
7
-
8
6
export WORKON_HOME=" ${TMPDIR:-/ tmp} /WORKON_HOME"
9
7
10
8
oneTimeSetUp () {
11
9
rm -rf " $WORKON_HOME "
12
10
mkdir -p " $WORKON_HOME "
11
+ source " $test_dir /../virtualenvwrapper.sh"
13
12
}
14
13
15
14
oneTimeTearDown () {
@@ -39,12 +38,12 @@ test_activates () {
39
38
40
39
test_hooks () {
41
40
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"
43
42
chmod +x " $WORKON_HOME /premkvirtualenv"
44
43
echo " echo GLOBAL postmkvirtualenv >> $test_dir /catch_output" > " $WORKON_HOME /postmkvirtualenv"
45
44
mkvirtualenv " env3"
46
45
output=$( cat " $test_dir /catch_output" )
47
- expected=" GLOBAL premkvirtualenv
46
+ expected=" GLOBAL premkvirtualenv $WORKON_HOME env3
48
47
GLOBAL postmkvirtualenv"
49
48
assertSame " $expected " " $output "
50
49
rm -f " $WORKON_HOME /premkvirtualenv"
Original file line number Diff line number Diff line change @@ -42,13 +42,15 @@ test_virtualenvwrapper_source_hook_permissions() {
42
42
}
43
43
44
44
test_virtualenvwrapper_run_hook_permissions () {
45
+ echo " #!/bin/sh" > " $WORKON_HOME /prermvirtualenv"
45
46
echo " echo run $@ >> \" $test_dir /catch_output\" " >> " $WORKON_HOME /prermvirtualenv"
46
47
chmod -x " $WORKON_HOME /prermvirtualenv"
47
48
touch " $test_dir /catch_output"
48
- virtualenvwrapper_run_hook " pre_rmvirtualenv" " foo"
49
+ error= $( virtualenvwrapper_run_hook " pre_rmvirtualenv" " foo" 2>&1 | grep " ERROR " )
49
50
output=$( cat " $test_dir /catch_output" )
50
51
expected=" "
51
52
assertSame " $expected " " $output "
53
+ assertSame " virtualenvwrapper.user_scripts ERROR: Could not run $WORKON_HOME /prermvirtualenv. [Errno 13] Permission denied" " $error "
52
54
}
53
55
54
56
. " $test_dir /shunit2"
Original file line number Diff line number Diff line change 3
3
# set -x
4
4
5
5
test_dir=$( dirname $0 )
6
- source " $test_dir /../virtualenvwrapper.sh"
7
6
8
7
export WORKON_HOME=" ${TMPDIR:-/ tmp} /WORKON_HOME"
9
8
10
9
oneTimeSetUp () {
11
10
rm -rf " $WORKON_HOME "
12
11
mkdir -p " $WORKON_HOME "
12
+ source " $test_dir /../virtualenvwrapper.sh"
13
13
mkvirtualenv " env1"
14
14
}
15
15
@@ -70,8 +70,8 @@ test_deactivate_hooks () {
70
70
71
71
for t in pre post
72
72
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"
75
75
done
76
76
77
77
touch " $test_dir /catch_output"
@@ -81,8 +81,8 @@ test_deactivate_hooks () {
81
81
output=$( cat " $test_dir /catch_output" )
82
82
expected=" ENV predeactivate
83
83
GLOBAL predeactivate
84
- ENV postdeactivate
85
- GLOBAL postdeactivate"
84
+ ENV postdeactivate $WORKON_HOME /env1
85
+ GLOBAL postdeactivate $WORKON_HOME /env1 "
86
86
assertSame " $expected " " $output "
87
87
88
88
for t in pre post
You can’t perform that action at this time.
0 commit comments