@@ -25,7 +25,7 @@ setUp () {
2525}
2626
2727tearDown () {
28- deactivate > /dev/null 2>&1
28+ deactivate > /dev/null 2>&1
2929}
3030
3131test_workon () {
@@ -50,22 +50,55 @@ test_workon_activate_hooks () {
5050 touch " $TMPDIR /catch_output"
5151
5252 workon test1
53-
53+
5454 output=$( cat " $TMPDIR /catch_output" )
5555 expected=" GLOBAL preactivate
5656ENV preactivate
5757GLOBAL postactivate
5858ENV postactivate"
5959
6060 assertSame " $expected " " $output "
61-
61+
6262 for t in pre post
6363 do
6464 rm -f " $WORKON_HOME /test1/bin/${t} activate"
6565 rm -f " $WORKON_HOME /${t} activate"
6666 done
6767}
6868
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+
69102test_virtualenvwrapper_show_workon_options () {
70103 mkdir " $WORKON_HOME /not_env"
71104 (cd " $WORKON_HOME " ; ln -s test1 link_env)
0 commit comments