Skip to content

Commit adbfd8b

Browse files
committed
Centralize setup of variables for tests.
Change WORKON_HOME and PROJECT_HOME for tests to make them unique across runs, allowing simultaneous test runs in different sandboxes.
1 parent 18268cc commit adbfd8b

27 files changed

+33
-59
lines changed

tests/setup.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Setup globals used by the tests
2+
3+
tmplocation=${TMPDIR:-/tmp}
4+
5+
export WORKON_HOME="$(echo ${tmplocation}/WORKON_HOME.$$ | sed 's|//|/|g')"
6+
export PROJECT_HOME="$(echo ${tmplocation}/PROJECT_HOME.$$ | sed 's|//|/|g')"

tests/test.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
#set -x
44

55
test_dir=$(cd $(dirname $0) && pwd)
6-
7-
export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
6+
source "$test_dir/setup.sh"
87

98
oneTimeSetUp() {
109
rm -rf "$WORKON_HOME"

tests/test_add2virtualenv.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
#set -x
44

55
test_dir=$(cd $(dirname $0) && pwd)
6-
7-
export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
6+
source "$test_dir/setup.sh"
87

98
oneTimeSetUp() {
109
rm -rf "$WORKON_HOME"

tests/test_cd.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
#set -x
44

55
test_dir=$(cd $(dirname $0) && pwd)
6-
7-
export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
6+
source "$test_dir/setup.sh"
87

98
oneTimeSetUp() {
109
rm -rf "$WORKON_HOME"

tests/test_cp.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
#set -x
44

55
test_dir=$(cd $(dirname $0) && pwd)
6-
7-
export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
6+
source "$test_dir/setup.sh"
87

98
#unset HOOK_VERBOSE_OPTION
109

tests/test_deactivate.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
#set -x
44

55
test_dir=$(cd $(dirname $0) && pwd)
6-
7-
export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
6+
source "$test_dir/setup.sh"
87

98
oneTimeSetUp() {
109
rm -rf "$WORKON_HOME"

tests/test_derive_workon_home.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
#set -x
44

55
test_dir=$(cd $(dirname $0) && pwd)
6-
7-
export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
6+
source "$test_dir/setup.sh"
87
TMP_WORKON_HOME="$WORKON_HOME"
98

109
oneTimeSetUp() {

tests/test_dir_stack.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
#set -x
44

55
test_dir=$(cd $(dirname $0) && pwd)
6-
7-
export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
6+
source "$test_dir/setup.sh"
87

98
#unset HOOK_VERBOSE_OPTION
109

tests/test_hook_dir.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
#set -x
44

55
test_dir=$(cd $(dirname $0) && pwd)
6-
7-
export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
6+
source "$test_dir/setup.sh"
87

98
oneTimeSetUp() {
109
rm -rf "$WORKON_HOME"

tests/test_log_dir.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
#set -x
44

55
test_dir=$(cd $(dirname $0) && pwd)
6-
7-
export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
6+
source "$test_dir/setup.sh"
87

98
setUp () {
109
echo

0 commit comments

Comments
 (0)