Skip to content

Commit 4fa1041

Browse files
committed
add test for project hook scripts
1 parent 6302c43 commit 4fa1041

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/test_project.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,24 @@ test_virtualenvwrapper_verify_project_home_missing_dir() {
5252
PROJECT_HOME="$old_home"
5353
}
5454

55+
test_virtualenvwrapper_postactivate_hook() {
56+
load_wrappers
57+
mkproject "test_project_hook"
58+
mkdir .virtualenvwrapper
59+
echo "export TEST_PROJECT_HOOK_VAR=true" > .virtualenvwrapper/postactivate
60+
echo "unset TEST_PROJECT_HOOK_VAR" > .virtualenvwrapper/predeactivate
61+
deactivate
62+
63+
# Variable should not be set to start
64+
assertSame "${TEST_PROJECT_HOOK_VAR}" ""
65+
66+
# Activating the env should set it
67+
workon "test_project_hook"
68+
assertSame "true" "${TEST_PROJECT_HOOK_VAR}"
69+
70+
# Deactivating should unset it
71+
deactivate
72+
assertSame "" "${TEST_PROJECT_HOOK_VAR}"
73+
}
74+
5575
. "$test_dir/shunit2"

0 commit comments

Comments
 (0)