-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathtest_mktmpenv.sh
More file actions
executable file
·59 lines (47 loc) · 1.3 KB
/
test_mktmpenv.sh
File metadata and controls
executable file
·59 lines (47 loc) · 1.3 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# -*- mode: shell-script -*-
test_dir=$(cd $(dirname $0) && pwd)
source "$test_dir/setup.sh"
oneTimeSetUp() {
rm -rf "$WORKON_HOME"
mkdir -p "$WORKON_HOME"
load_wrappers
}
oneTimeTearDown() {
rm -rf "$WORKON_HOME"
}
setUp () {
echo
}
test_mktmpenv_no_name() {
before=$(lsvirtualenv -b)
mktmpenv >/dev/null 2>&1
after=$(lsvirtualenv -b)
assertFalse "Environment was not created" "[ \"$before\" = \"$after\" ]"
assertSame "$VIRTUAL_ENV" "$(pwd)"
}
test_mktmpenv_name() {
mktmpenv name-given-by-user >/dev/null 2>&1
RC=$?
assertTrue "Error was not detected" "[ $RC -ne 0 ]"
}
test_mktmpenv_n() {
mktmpenv -n >/dev/null 2>&1
assertNotSame "$VIRTUAL_ENV" "$(pwd)"
}
test_mktmpenv_no_cd() {
mktmpenv --no-cd >/dev/null 2>&1
assertNotSame "$VIRTUAL_ENV" "$(pwd)"
}
test_mktmpenv_virtualenv_args() {
mktmpenv --without-pip >/dev/null 2>&1
contents="$(lssitepackages)"
assertFalse "found pip in site-packages: ${contents}" "echo $contents | grep -q pip"
}
test_deactivate() {
mktmpenv >/dev/null 2>&1
assertTrue "Environment was not created" "[ ! -z \"$VIRTUAL_ENV\" ]"
env_name=$(basename "$VIRTUAL_ENV")
deactivate >/dev/null 2>&1
assertFalse "Environment still exists" "[ -d \"$WORKON_HOME/$env_name\" ]"
}
. "$test_dir/shunit2"