Skip to content

Commit 62a8b8b

Browse files
committed
add test for lazy loading via workon; addresses #144
1 parent d56b8c4 commit 62a8b8b

File tree

2 files changed

+30
-17
lines changed

2 files changed

+30
-17
lines changed

tests/test_lazy.sh

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,21 +88,4 @@ test_mktmpenv_defined_lazy() {
8888
function_defined_lazy mktmpenv
8989
}
9090

91-
92-
# test_virtualenvwrapper_initialize() {
93-
# assertTrue "Initialized" virtualenvwrapper_initialize
94-
# for hook in premkvirtualenv postmkvirtualenv prermvirtualenv postrmvirtualenv preactivate postactivate predeactivate postdeactivate
95-
# do
96-
# assertTrue "Global $WORKON_HOME/$hook was not created" "[ -f $WORKON_HOME/$hook ]"
97-
# assertTrue "Global $WORKON_HOME/$hook is not executable" "[ -x $WORKON_HOME/$hook ]"
98-
# done
99-
# assertTrue "Log file was not created" "[ -f $WORKON_HOME/hook.log ]"
100-
# export pre_test_dir=$(cd "$test_dir"; pwd)
101-
# echo "echo GLOBAL initialize >> \"$pre_test_dir/catch_output\"" >> "$WORKON_HOME/initialize"
102-
# virtualenvwrapper_initialize
103-
# output=$(cat "$test_dir/catch_output")
104-
# expected="GLOBAL initialize"
105-
# assertSame "$expected" "$output"
106-
# }
107-
10891
. "$test_dir/shunit2"

tests/test_lazy_run.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
3+
test_dir=$(cd $(dirname $0) && pwd)
4+
source "$test_dir/setup.sh"
5+
6+
oneTimeSetUp() {
7+
rm -rf "$WORKON_HOME"
8+
mkdir -p "$WORKON_HOME"
9+
(cd "$WORKON_HOME" && virtualenv lazy_load_test >/dev/null 2>&1)
10+
source "$test_dir/../virtualenvwrapper_lazy.sh"
11+
}
12+
13+
oneTimeTearDown() {
14+
rm -rf "$WORKON_HOME"
15+
}
16+
17+
setUp () {
18+
echo
19+
rm -f "$test_dir/catch_output"
20+
}
21+
22+
test_workon_changes_defs() {
23+
# See issue #144
24+
assertFalse "virtualenvwrapper_run_hook is already defined" "type virtualenvwrapper_run_hook"
25+
workon lazy_load_test >/dev/null 2>&1
26+
assertTrue "virtualenvwrapper_run_hook is not defined" "type virtualenvwrapper_run_hook"
27+
assertTrue "workon still set to run lazy loader" "typeset -f $name | grep 'virtualenvwrapper_load'"
28+
}
29+
30+
. "$test_dir/shunit2"

0 commit comments

Comments
 (0)