Skip to content

Commit c209d1f

Browse files
committed
test for 'mkvirtualenv -a <project_path>'
1 parent ca54320 commit c209d1f

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/test_mkvirtualenv_associate.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+
rm -f "$test_dir/requirements.txt"
18+
}
19+
20+
setUp () {
21+
echo
22+
rm -f "$test_dir/catch_output"
23+
}
24+
25+
test_associate() {
26+
project="/dev/null"
27+
env="env1"
28+
ptrfile="$WORKON_HOME/$env/.project"
29+
mkvirtualenv -a "$project" "$env" >/dev/null 2>&1
30+
assertTrue ".project not found" "[ -f $ptrfile ]"
31+
assertEquals "$ptrfile contains wrong content" "$project" "$(cat $ptrfile)"
32+
}
33+
34+
. "$test_dir/shunit2"

0 commit comments

Comments
 (0)