File: test_hook_dir.sh~

package info (click to toggle)
virtualenvwrapper 3.4-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,140 kB
  • sloc: sh: 3,801; python: 991; makefile: 27
file content (35 lines) | stat: -rw-r--r-- 871 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh

#set -x

test_dir=$(cd $(dirname $0) && pwd)

export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"

oneTimeSetUp() {
    rm -rf "$WORKON_HOME"
    mkdir -p "$WORKON_HOME"
    mkdir -p "$WORKON_HOME/hooks"
}

oneTimeTearDown() {
    rm -rf "$WORKON_HOME"
}

setUp () {
    echo
    rm -f "$test_dir/catch_output"
    rm -f "$WORKON_HOME/hooks/*"
}

test_virtualenvwrapper_initialize() {
    export VIRTUALENVWRAPPER_HOOK_DIR="$WORKON_HOME/hooks"
    source "$test_dir/../virtualenvwrapper.sh"
    for hook in premkvirtualenv postmkvirtualenv prermvirtualenv postrmvirtualenv preactivate postactivate predeactivate postdeactivate
    do
        assertTrue "Global $hook was not created" "[ -f $WORKON_HOME/hooks/$hook ]"
        assertTrue "Global $hook is not executable" "[ -x $WORKON_HOME/hooks/$hook ]"
    done
}

. "$test_dir/shunit2"