@@ -25,7 +25,7 @@ setUp () {
25
25
}
26
26
27
27
tearDown () {
28
- deactivate > /dev/null 2>&1
28
+ deactivate > /dev/null 2>&1
29
29
}
30
30
31
31
test_workon () {
@@ -50,22 +50,55 @@ test_workon_activate_hooks () {
50
50
touch " $TMPDIR /catch_output"
51
51
52
52
workon test1
53
-
53
+
54
54
output=$( cat " $TMPDIR /catch_output" )
55
55
expected=" GLOBAL preactivate
56
56
ENV preactivate
57
57
GLOBAL postactivate
58
58
ENV postactivate"
59
59
60
60
assertSame " $expected " " $output "
61
-
61
+
62
62
for t in pre post
63
63
do
64
64
rm -f " $WORKON_HOME /test1/bin/${t} activate"
65
65
rm -f " $WORKON_HOME /${t} activate"
66
66
done
67
67
}
68
68
69
+ test_workon_deactivate_hooks () {
70
+ for t in pre post
71
+ do
72
+ echo " #!/bin/sh" > " $WORKON_HOME /${t} deactivate"
73
+ echo " echo GLOBAL ${t} deactivate >> \" $TMPDIR /catch_output\" " >> " $WORKON_HOME /${t} deactivate"
74
+ chmod +x " $WORKON_HOME /${t} deactivate"
75
+
76
+ echo " #!/bin/sh" > " $WORKON_HOME /test2/bin/${t} deactivate"
77
+ echo " echo ENV ${t} deactivate >> \" $TMPDIR /catch_output\" " >> " $WORKON_HOME /test1/bin/${t} deactivate"
78
+ chmod +x " $WORKON_HOME /test1/bin/${t} deactivate"
79
+ done
80
+
81
+ rm -f " $TMPDIR /catch_output"
82
+ touch " $TMPDIR /catch_output"
83
+
84
+ workon test1
85
+ workon test2
86
+
87
+ output=$( cat " $TMPDIR /catch_output" )
88
+ expected=" ENV predeactivate
89
+ GLOBAL predeactivate
90
+ ENV postdeactivate
91
+ GLOBAL postdeactivate"
92
+
93
+ assertSame " $expected " " $output "
94
+
95
+ for t in pre post
96
+ do
97
+ rm -f " $WORKON_HOME /test1/bin/${t} deactivate"
98
+ rm -f " $WORKON_HOME /${t} deactivate"
99
+ done
100
+ }
101
+
69
102
test_virtualenvwrapper_show_workon_options () {
70
103
mkdir " $WORKON_HOME /not_env"
71
104
(cd " $WORKON_HOME " ; ln -s test1 link_env)
0 commit comments