File tree Expand file tree Collapse file tree 5 files changed +72
-37
lines changed Expand file tree Collapse file tree 5 files changed +72
-37
lines changed Original file line number Diff line number Diff line change 1
1
2010-04-29 Doug Hellmann <
[email protected] >
2
2
3
+ * tests/test_workon.sh: Refactor deactivate tests into their own
4
+ script.
5
+
6
+ * tests/test_deactivate.sh: Refactor deactivate tests into their
7
+ own script.
8
+
3
9
* virtualenvwrapper.sh (virtualenvwrapper_get_python_version): Add
4
10
a comment about why we're using the $PATH python instead of the
5
11
one where the wrappers are installed.
6
12
(add2virtualenv): Use the install-tree python instead of the one
7
13
from $PATH.
14
+ (deactivate): Ignore errors from redundant unset calls.
8
15
9
16
2010-04-26 Doug Hellmann <
[email protected] >
10
17
Original file line number Diff line number Diff line change 11
11
- Fixed improper use of python from ``$PATH `` instead of the
12
12
location where the wrappers are installed. See `issue #41
13
13
<http://bitbucket.org/dhellmann/virtualenvwrapper/issue/41/> `__.
14
+ - Quiet spurrious error/warning messages when deactivating a
15
+ virtualenv under zsh. See `issue #42
16
+ <http://bitbucket.org/dhellmann/virtualenvwrapper/issue/42/> `__.
14
17
15
18
2.1
16
19
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ # set -x
4
+
5
+ test_dir=$( dirname $0 )
6
+
7
+ export WORKON_HOME=" ${TMPDIR:-/ tmp} /WORKON_HOME"
8
+
9
+ oneTimeSetUp () {
10
+ rm -rf " $WORKON_HOME "
11
+ mkdir -p " $WORKON_HOME "
12
+ source " $test_dir /../virtualenvwrapper.sh"
13
+ mkvirtualenv " env1"
14
+ }
15
+
16
+ oneTimeTearDown () {
17
+ rm -rf " $WORKON_HOME "
18
+ }
19
+
20
+ setUp () {
21
+ echo
22
+ rm -f " $test_dir /catch_output"
23
+ }
24
+
25
+ test_deactivate () {
26
+ workon env1
27
+ assertNotNull " $VIRTUAL_ENV "
28
+ deactivate
29
+ assertNull " $VIRTUAL_ENV "
30
+ assertFalse virtualenvwrapper_verify_active_environment
31
+ }
32
+
33
+ test_deactivate_hooks () {
34
+ workon env1
35
+
36
+ for t in pre post
37
+ do
38
+ echo " echo GLOBAL ${t} deactivate \$ VIRTUALENVWRAPPER_LAST_VIRTUAL_ENV >> $test_dir /catch_output" > " $WORKON_HOME /${t} deactivate"
39
+ echo " echo ENV ${t} deactivate \$ VIRTUALENVWRAPPER_LAST_VIRTUAL_ENV >> $test_dir /catch_output" > " $WORKON_HOME /env1/bin/${t} deactivate"
40
+ done
41
+
42
+ touch " $test_dir /catch_output"
43
+
44
+ deactivate
45
+
46
+ output=$( cat " $test_dir /catch_output" )
47
+ expected=" ENV predeactivate
48
+ GLOBAL predeactivate
49
+ ENV postdeactivate $WORKON_HOME /env1
50
+ GLOBAL postdeactivate $WORKON_HOME /env1"
51
+ assertSame " $expected " " $output "
52
+
53
+ for t in pre post
54
+ do
55
+ rm -f " $WORKON_HOME /env1/bin/${t} activate"
56
+ rm -f " $WORKON_HOME /${t} activate"
57
+ done
58
+ }
59
+
60
+ . " $test_dir /shunit2"
Original file line number Diff line number Diff line change @@ -57,41 +57,6 @@ ENV postactivate"
57
57
done
58
58
}
59
59
60
- test_deactivate () {
61
- workon env1
62
- assertNotNull " $VIRTUAL_ENV "
63
- deactivate
64
- assertNull " $VIRTUAL_ENV "
65
- assertFalse virtualenvwrapper_verify_active_environment
66
- }
67
-
68
- test_deactivate_hooks () {
69
- workon env1
70
-
71
- for t in pre post
72
- do
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
- done
76
-
77
- touch " $test_dir /catch_output"
78
-
79
- deactivate
80
-
81
- output=$( cat " $test_dir /catch_output" )
82
- expected=" ENV predeactivate
83
- GLOBAL predeactivate
84
- ENV postdeactivate $WORKON_HOME /env1
85
- GLOBAL postdeactivate $WORKON_HOME /env1"
86
- assertSame " $expected " " $output "
87
-
88
- for t in pre post
89
- do
90
- rm -f " $WORKON_HOME /env1/bin/${t} activate"
91
- rm -f " $WORKON_HOME /${t} activate"
92
- done
93
- }
94
-
95
60
test_virtualenvwrapper_show_workon_options () {
96
61
mkdir " $WORKON_HOME /not_env"
97
62
(cd " $WORKON_HOME " ; ln -s env1 link_env)
Original file line number Diff line number Diff line change @@ -262,8 +262,8 @@ workon () {
262
262
if [ ! "$1" = "nondestructive" ]
263
263
then
264
264
# Remove this function
265
- unset -f virtualenv_deactivate
266
- unset -f deactivate
265
+ unset -f virtualenv_deactivate >/dev/null 2>&1
266
+ unset -f deactivate >/dev/null 2>&1
267
267
fi
268
268
269
269
}'
You can’t perform that action at this time.
0 commit comments