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() {
1010 source " $test_dir /../virtualenvwrapper.sh"
1111 mkvirtualenv cd-test > /dev/null 2>&1
1212 deactivate
13- alias cd=' fail "Should not be using override cd function"'
1413}
1514
1615oneTimeTearDown () {
@@ -27,10 +26,27 @@ tearDown () {
2726}
2827
2928test_cd () {
29+ alias cd=' fail "Should not be using override cd function"'
3030 start_dir=" $( pwd) "
3131 virtualenvwrapper_cd " $VIRTUAL_ENV "
3232 assertSame " $VIRTUAL_ENV " " $( pwd) "
3333 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
3450}
3551
3652. " $test_dir /shunit2"
Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ function virtualenvwrapper_cd {
109109 builtin \c d " $@ "
110110 elif [ -n " $ZSH_VERSION " ]
111111 then
112- builtin \c d " $@ "
112+ builtin \c d -q " $@ "
113113 else
114114 command \c d " $@ "
115115 fi
You can’t perform that action at this time.
0 commit comments