File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ oneTimeSetUp() {
10
10
source " $test_dir /../virtualenvwrapper.sh"
11
11
mkvirtualenv cd-test > /dev/null 2>&1
12
12
deactivate
13
- alias cd=' fail "Should not be using override cd function"'
14
13
}
15
14
16
15
oneTimeTearDown () {
@@ -27,10 +26,27 @@ tearDown () {
27
26
}
28
27
29
28
test_cd () {
29
+ alias cd=' fail "Should not be using override cd function"'
30
30
start_dir=" $( pwd) "
31
31
virtualenvwrapper_cd " $VIRTUAL_ENV "
32
32
assertSame " $VIRTUAL_ENV " " $( pwd) "
33
33
virtualenvwrapper_cd " $start_dir "
34
+ unalias cd
35
+ }
36
+
37
+ # Define hook function to make cd break
38
+ chpwd () {
39
+ return 1
40
+ }
41
+ # Run a test that uses cd to ensure the hook is not called
42
+ test_cd_zsh_chpwd_not_called () {
43
+ if [ -n " $ZSH_VERSION " ]; then
44
+ start_dir=" $( pwd) "
45
+ virtualenvwrapper_cd " $VIRTUAL_ENV "
46
+ assertSame " $VIRTUAL_ENV " " $( pwd) "
47
+ virtualenvwrapper_cd " $start_dir "
48
+ fi
49
+ unset -f chpwd > /dev/null 2>&1
34
50
}
35
51
36
52
. " $test_dir /shunit2"
Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ function virtualenvwrapper_cd {
109
109
builtin \c d " $@ "
110
110
elif [ -n " $ZSH_VERSION " ]
111
111
then
112
- builtin \c d " $@ "
112
+ builtin \c d -q " $@ "
113
113
else
114
114
command \c d " $@ "
115
115
fi
You can’t perform that action at this time.
0 commit comments