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

« back to all changes in this revision

Viewing changes to tests/test_ls.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
}
 
14
 
 
15
oneTimeTearDown() {
 
16
    rm -rf "$WORKON_HOME"
 
17
}
 
18
 
 
19
setUp () {
 
20
    echo
 
21
    rm -f "$test_dir/catch_output"
 
22
}
 
23
 
 
24
test_get_site_packages_dir () {
 
25
    mkvirtualenv "lssitepackagestest" >/dev/null 2>&1
 
26
    d=$(virtualenvwrapper_get_site_packages_dir)
 
27
    echo "site-packages in $d"
 
28
    assertTrue "site-packages dir $d does not exist" "[ -d $d ]"
 
29
    deactivate
 
30
}
 
31
 
 
32
test_lssitepackages () {
 
33
    mkvirtualenv "lssitepackagestest" >/dev/null 2>&1
 
34
    contents="$(lssitepackages)"    
 
35
    actual=$(echo $contents | grep easy-install.pth)
 
36
    expected=$(echo $contents)
 
37
    assertSame "$expected" "$actual"
 
38
    deactivate
 
39
}
 
40
 
 
41
test_lssitepackages_add2virtualenv () {
 
42
    mkvirtualenv "lssitepackagestest" >/dev/null 2>&1
 
43
    parent_dir=$(dirname $(pwd))
 
44
    base_dir=$(basename $(pwd))
 
45
    add2virtualenv "../$base_dir"
 
46
    contents="$(lssitepackages)"    
 
47
    actual=$(echo $contents | grep $base_dir)
 
48
    expected=$(echo $contents)
 
49
    assertSame "$expected" "$actual"
 
50
    deactivate
 
51
}
 
52
 
 
53
test_no_workon_home () {
 
54
    old_home="$WORKON_HOME"
 
55
    export WORKON_HOME="$WORKON_HOME/not_there"
 
56
    lssitepackages >"$old_home/output" 2>&1
 
57
    output=$(cat "$old_home/output")
 
58
    assertTrue "Did not see expected message" "echo $output | grep 'does not exist'"
 
59
    WORKON_HOME="$old_home"
 
60
}
 
61
 
 
62
 
 
63
. "$test_dir/shunit2"