~ubuntu-branches/ubuntu/trusty/virtualenvwrapper/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/test_mkvirtualenv_associate.sh

  • Committer: Package Import Robot
  • Author(s): Jan Dittberner
  • Date: 2012-05-17 14:24:08 UTC
  • mfrom: (1.2.15)
  • Revision ID: package-import@ubuntu.com-20120517142408-5dexv6w1cldbzx3j
Tags: 3.3-1
* New upstream version
* change Build-Depends for dh_sphinxdoc to python-sphinx (>=
  1.0.7+dfsg) | python3-sphinx
* bump Standards-Version to 3.9.3 (no changes)
* refresh debian/patches/debianspecific-setup.py.patch
* use symlinks for duplicated ajax-loader.gif
* Fix "FTBFS if built twice in a row: virtualenvwrapper/__init__.pyc:
  binary file contents changed" by removing *.pyc in clean target
  (Closes: #641735)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
 
3
 
#set -x
4
 
 
5
3
test_dir=$(cd $(dirname $0) && pwd)
6
 
 
7
 
export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
 
4
source "$test_dir/setup.sh"
8
5
 
9
6
oneTimeSetUp() {
10
7
    rm -rf "$WORKON_HOME"
20
17
setUp () {
21
18
    echo
22
19
    rm -f "$test_dir/catch_output"
 
20
    echo "#!/bin/sh" > "$WORKON_HOME/preactivate"
 
21
    echo "#!/bin/sh" > "$WORKON_HOME/postactivate"
23
22
}
24
23
 
25
24
test_associate() {
31
30
    assertEquals "$ptrfile contains wrong content" "$project" "$(cat $ptrfile)"
32
31
}
33
32
 
 
33
test_preactivate() {
 
34
    project="/dev/null"
 
35
    env="env2"
 
36
    ptrfile="$WORKON_HOME/$env/.project"
 
37
        cat - >"$WORKON_HOME/preactivate" <<EOF
 
38
#!/bin/sh
 
39
if [ -f "$ptrfile" ]
 
40
then
 
41
    echo exists >> "$test_dir/catch_output"
 
42
else
 
43
    echo noexists >> "$test_dir/catch_output"
 
44
fi
 
45
EOF
 
46
    chmod +x "$WORKON_HOME/preactivate"
 
47
    mkvirtualenv -a "$project" "$env" >/dev/null 2>&1
 
48
        assertSame "preactivate did not find file" "exists" "$(cat $test_dir/catch_output)"
 
49
}
 
50
 
 
51
test_postactivate() {
 
52
    project="/dev/null"
 
53
    env="env3"
 
54
    ptrfile="$WORKON_HOME/$env/.project"
 
55
cat - >"$WORKON_HOME/postactivate" <<EOF
 
56
#!/bin/sh
 
57
if [ -f "$ptrfile" ]
 
58
then
 
59
    echo exists >> "$test_dir/catch_output"
 
60
else
 
61
    echo noexists >> "$test_dir/catch_output"
 
62
fi
 
63
EOF
 
64
    chmod +x "$WORKON_HOME/postactivate"
 
65
    mkvirtualenv -a "$project" "$env" >/dev/null 2>&1
 
66
        assertSame "postactivate did not find file" "exists" "$(cat $test_dir/catch_output)"
 
67
}
 
68
 
34
69
. "$test_dir/shunit2"