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

« back to all changes in this revision

Viewing changes to tests/test_deactivate.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
#!/bin/sh
 
2
 
 
3
#set -x
 
4
 
 
5
test_dir=$(cd $(dirname $0) && pwd)
 
6
 
 
7
export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
 
8
 
 
9
oneTimeSetUp() {
 
10
    rm -rf "$WORKON_HOME"
 
11
    mkdir -p "$WORKON_HOME"
 
12
    source "$test_dir/../virtualenvwrapper.sh"
 
13
    mkvirtualenv "env1"
 
14
}
 
15
 
 
16
oneTimeTearDown() {
 
17
    rm -rf "$WORKON_HOME"
 
18
}
 
19
 
 
20
setUp () {
 
21
    echo
 
22
    rm -f "$test_dir/catch_output"
 
23
}
 
24
 
 
25
test_deactivate () {
 
26
    workon env1
 
27
    assertNotNull "$VIRTUAL_ENV"
 
28
    deactivate
 
29
    assertNull "$VIRTUAL_ENV"
 
30
    assertFalse virtualenvwrapper_verify_active_environment    
 
31
}
 
32
 
 
33
test_deactivate_hooks () {
 
34
    workon env1
 
35
 
 
36
    for t in pre post
 
37
    do
 
38
        echo "echo GLOBAL ${t}deactivate \$VIRTUALENVWRAPPER_LAST_VIRTUAL_ENV >> $test_dir/catch_output" > "$WORKON_HOME/${t}deactivate"
 
39
        echo "echo ENV ${t}deactivate \$VIRTUALENVWRAPPER_LAST_VIRTUAL_ENV >> $test_dir/catch_output" > "$WORKON_HOME/env1/bin/${t}deactivate"
 
40
    done
 
41
 
 
42
    touch "$test_dir/catch_output"
 
43
 
 
44
    deactivate
 
45
 
 
46
    output=$(cat "$test_dir/catch_output")
 
47
    expected="ENV predeactivate
 
48
GLOBAL predeactivate
 
49
ENV postdeactivate $WORKON_HOME/env1
 
50
GLOBAL postdeactivate $WORKON_HOME/env1"
 
51
    assertSame "$expected" "$output"
 
52
    
 
53
    for t in pre post
 
54
    do
 
55
        rm -f "$WORKON_HOME/env1/bin/${t}activate"
 
56
        rm -f "$WORKON_HOME/${t}activate"
 
57
    done
 
58
}
 
59
 
 
60
. "$test_dir/shunit2"