Skip to content

Commit f09399e

Browse files
committed
add a test to verify pushd/popd behavior; addresses #101
1 parent e6b0201 commit f09399e

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

tests/test_dir_stack.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/sh
2+
3+
#set -x
4+
5+
test_dir=$(cd $(dirname $0) && pwd)
6+
7+
export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
8+
9+
#unset HOOK_VERBOSE_OPTION
10+
11+
setUp () {
12+
rm -rf "$WORKON_HOME"
13+
mkdir -p "$WORKON_HOME"
14+
source "$test_dir/../virtualenvwrapper.sh"
15+
mkdir "$WORKON_HOME/start_here"
16+
mkdir "$WORKON_HOME/on_the_stack"
17+
echo
18+
}
19+
20+
tearDown() {
21+
if type deactivate >/dev/null 2>&1
22+
then
23+
deactivate
24+
fi
25+
rm -rf "$WORKON_HOME"
26+
}
27+
28+
test_ticket_101 () {
29+
mkvirtualenv some_env
30+
deactivate
31+
cd "$WORKON_HOME/start_here"
32+
pushd "$WORKON_HOME/on_the_stack"
33+
rmvirtualenv some_env
34+
mkvirtualenv --no-site-packages some_env
35+
#echo "After mkvirtualenv: `pwd`"
36+
deactivate
37+
#echo "After deactivate: `pwd`"
38+
popd
39+
#echo "After popd: `pwd`"
40+
current_dir=$(pwd)
41+
assertSame "$WORKON_HOME/start_here" "$current_dir"
42+
}
43+
44+
. "$test_dir/shunit2"

0 commit comments

Comments
 (0)