4
4
5
5
test_dir=$( cd $( dirname $0 ) && pwd)
6
6
7
- export WORKON_HOME=" $( echo ${TMPDIR:-/ tmp} /WORKON_HOME | sed ' s|//|/|g' ) "
7
+ tmplocation=${TMPDIR:-/ tmp}
8
+ export WORKON_HOME=" $( echo ${tmplocation} /WORKON_HOME | sed ' s|//|/|g' ) "
8
9
9
10
export HOOK_VERBOSE_OPTION=-v
10
11
@@ -28,15 +29,15 @@ test_tempfile () {
28
29
filename=$( virtualenvwrapper_tempfile hook)
29
30
assertTrue " Filename is empty" " [ ! -z \" $filename \" ]"
30
31
rm -f $filename
31
- comparable_tmpdir=$( echo $TMPDIR | sed ' s|/$||' )
32
+ comparable_tmpdir=$( echo $tmplocation | sed ' s|/$||' )
32
33
comparable_dirname=$( dirname $filename | sed ' s|/$||' )
33
- assertSame " TMPDIR and path not the same for $filename " " $comparable_tmpdir " " $comparable_dirname "
34
+ assertSame " Temporary directory \" $tmplocation \" and path not the same for $filename " " $comparable_tmpdir " " $comparable_dirname "
34
35
assertTrue " virtualenvwrapper-hook not in filename." " echo $filename | grep virtualenvwrapper-hook"
35
36
}
36
37
37
38
test_no_such_tmpdir () {
38
39
old_tmpdir=" $TMPDIR "
39
- TMPDIR=" $TMPDIR /does-not-exist"
40
+ export TMPDIR=" $tmplocation /does-not-exist"
40
41
virtualenvwrapper_run_hook " initialize" > /dev/null 2>&1
41
42
RC=$?
42
43
assertSame " Unexpected exit code $RC " " 1" " $RC "
@@ -45,7 +46,7 @@ test_no_such_tmpdir () {
45
46
46
47
test_tmpdir_not_writable () {
47
48
old_tmpdir=" $TMPDIR "
48
- TMPDIR=" $TMPDIR /cannot-write"
49
+ export TMPDIR=" $tmplocation /cannot-write"
49
50
mkdir " $TMPDIR "
50
51
chmod ugo-w " $TMPDIR "
51
52
virtualenvwrapper_run_hook " initialize" > /dev/null 2>&1
0 commit comments