File: test_hook_dir.sh

package info (click to toggle)
virtualenvwrapper 4.8.4-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 796 kB
  • sloc: sh: 3,369; python: 595; makefile: 185
file content (39 lines) | stat: -rwxr-xr-x 1,135 bytes parent folder | download | duplicates (2)
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
36
37
38
39
# -*- mode: shell-script -*-

test_dir=$(cd $(dirname $0) && pwd)
source "$test_dir/setup.sh"

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

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

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

SOURCE_SCRIPTS="initialize postmkvirtualenv predeactivate postdeactivate postactivate "
RUN_SCRIPTS="premkvirtualenv prermvirtualenv postrmvirtualenv preactivate get_env_details"

test_virtualenvwrapper_initialize() {
    export VIRTUALENVWRAPPER_HOOK_DIR="$WORKON_HOME/hooks"
    source "$test_dir/../virtualenvwrapper.sh"
    for hook in $SOURCE_SCRIPTS
    do
        assertTrue "Global $WORKON_HOME/$hook was not created" "[ -f $WORKON_HOME/hooks/$hook ]"
        assertFalse "Global $WORKON_HOME/$hook is executable" "[ -x $WORKON_HOME/hooks/$hook ]"
    done
    for hook in $RUN_SCRIPTS
    do
        assertTrue "Global $WORKON_HOME/$hook was not created" "[ -f $WORKON_HOME/hooks/$hook ]"
        assertTrue "Global $WORKON_HOME/$hook is executable" "[ -x $WORKON_HOME/hooks/$hook ]"
    done
}

. "$test_dir/shunit2"