Skip to content

Commit 4e3d522

Browse files
committed
reorg test runner to remove redundant test runs
1 parent c3ba559 commit 4e3d522

34 files changed

+90
-85
lines changed

tests/run_tests

Lines changed: 24 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22

33
#set -x
44

5-
if [ -z "$TOXIC" ]
6-
then
7-
echo "Only run this via tox" 1>&2
8-
exit 1
9-
fi
10-
115
envdir="$1"
126
shift
137
scripts="$*"
@@ -21,25 +15,6 @@ then
2115
fi
2216
fi
2317

24-
# Make sure the test shells exist before proceeding, otherwise tests are
25-
# going to fail later.
26-
DESIRED_SHELLS=${DESIRED_SHELLS:-"bash zsh ksh"}
27-
missing_shells=""
28-
test_shells=""
29-
for shell in $DESIRED_SHELLS
30-
do
31-
if test_shell=$(which $shell); then
32-
test_shells="$test_shells $test_shell"
33-
else
34-
missing_shells="$missing_shells $shell"
35-
fi
36-
done
37-
if [ -n "$missing_shells" ]
38-
then
39-
echo "Couldn't find the following shells: $missing_shells" 1>&2
40-
exit 1
41-
fi
42-
4318
# Force the tox virtualenv to be active.
4419
#
4520
# Since this script runs from within a separate shell created by tox,
@@ -48,14 +23,19 @@ fi
4823
# are *not* inherited.
4924
#
5025
source "$envdir/bin/activate"
26+
TMPDIR="$envdir/tmp"
27+
export TMPDIR
28+
mkdir -p "$TMPDIR"
5129

5230
# Set up virtualenvwrapper.hook_loader to print more details than usual for debugging.
5331
#export HOOK_VERBOSE_OPTION=-vvv
54-
export HOOK_VERBOSE_OPTION="-q"
32+
HOOK_VERBOSE_OPTION="-q"
33+
export HOOK_VERBOSE_OPTION
5534

5635
# Force virtualenvwrapper to use the python interpreter in the
5736
# tox-created virtualenv.
58-
export VIRTUALENVWRAPPER_PYTHON="$envdir/bin/python"
37+
VIRTUALENVWRAPPER_PYTHON="$envdir/bin/python"
38+
export VIRTUALENVWRAPPER_PYTHON
5939

6040
# Clear any user settings for the hook directory or log directory
6141
unset VIRTUALENVWRAPPER_HOOK_DIR
@@ -68,31 +48,24 @@ unset VIRTUALENVWRAPPER_VIRTUALENV_ARGS
6848
for test_script in $scripts
6949
do
7050

71-
for test_shell in $test_shells
72-
do
73-
unset BASH
74-
unset ZSH_VERSION
75-
test_shell_opts=
76-
case /$test_shell in
77-
*/zsh) test_shell_opts="-o shwordsplit" ;;
78-
esac
79-
export test_shell
80-
export SHELL=$(which $test_shell)
51+
echo
52+
echo '********************************************************************************'
53+
echo "Running $test_script"
54+
echo " VIRTUAL_ENV=$VIRTUAL_ENV"
55+
echo " VIRTUALENVWRAPPER_PYTHON=$VIRTUALENVWRAPPER_PYTHON"
56+
echo " $($VIRTUALENVWRAPPER_PYTHON -V 2>&1)"
57+
echo " PYTHONPATH=$PYTHONPATH"
58+
echo " SHELL=$SHELL"
59+
echo " BASH_VERSION=$BASH_VERSION"
60+
echo " ZSH_VERSION=$ZSH_VERSION"
61+
echo " KSH_VERSION=$KSH_VERSION"
62+
echo " virtualenv=$(which virtualenv)"
63+
echo
64+
SHUNIT_PARENT="$test_script"
65+
export SHUNIT_PARENT
66+
$test_shell_opts $test_script || exit 1
67+
echo
8168

82-
echo
83-
echo '********************************************************************************'
84-
echo "Running $test_script"
85-
echo " VIRTUAL_ENV=$VIRTUAL_ENV"
86-
echo " VIRTUALENVWRAPPER_PYTHON=$VIRTUALENVWRAPPER_PYTHON"
87-
echo " $($VIRTUALENVWRAPPER_PYTHON -V 2>&1)"
88-
echo " PYTHONPATH=$PYTHONPATH"
89-
echo " SHELL=$test_shell"
90-
echo " virtualenv=$(which virtualenv)"
91-
echo
92-
export SHUNIT_PARENT="$test_script"
93-
$test_shell $test_shell_opts $test_script || exit 1
94-
echo
95-
done
9669
done
9770

9871
exit 0

tests/setup.sh

100644100755
File mode changed.

tests/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
# -*- mode: shell-script -*-
22

33
test_dir=$(cd $(dirname $0) && pwd)
44
source "$test_dir/setup.sh"

tests/test_add2virtualenv.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
# -*- mode: shell-script -*-
22

33
test_dir=$(cd $(dirname $0) && pwd)
44
source "$test_dir/setup.sh"

tests/test_cd.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
# -*- mode: shell-script -*-
22

33
test_dir=$(cd $(dirname $0) && pwd)
44
source "$test_dir/setup.sh"

tests/test_cp.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
# -*- mode: shell-script -*-
22

33
test_dir=$(cd $(dirname $0) && pwd)
44
source "$test_dir/setup.sh"

tests/test_cpvirtualenv.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#venv!/bin/sh
1+
# -*- mode: shell-script -*-
22

33
test_dir=$(cd $(dirname $0) && pwd)
44
source "$test_dir/setup.sh"

tests/test_deactivate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
# -*- mode: shell-script -*-
22

33
test_dir=$(cd $(dirname $0) && pwd)
44
source "$test_dir/setup.sh"

tests/test_derive_workon_home.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
# -*- mode: shell-script -*-
22

33
test_dir=$(cd $(dirname $0) && pwd)
44
source "$test_dir/setup.sh"

tests/test_dir_stack.sh

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
# -*- mode: shell-script -*-
22

33
test_dir=$(cd $(dirname $0) && pwd)
44
source "$test_dir/setup.sh"

0 commit comments

Comments
 (0)