fonttools/run-tests.sh
Behdad Esfahbod 587c0cd142 Revert "Revert "[run-test.sh] echo selected python interpreter version""
This reverts commit 551f9506b308697bea8d2c5597e1a853fac151f6.

Nice thing to have
2015-08-20 11:36:09 +01:00

51 lines
912 B
Bash
Executable File

#!/bin/sh
# Choose python version
if test "x$1" = x-3; then
PYTHON=python3
shift
elif test "x$1" = x-2; then
PYTHON=python2
shift
fi
test "x$PYTHON" = x && PYTHON=python
echo "$(which $PYTHON) --version"
$PYTHON --version 2>&1
echo
# Setup environment
DIR=`dirname "$0"`
cd "$DIR/Lib"
PYTHONPATH=".:$PYTHONPATH"
export PYTHONPATH
# Find tests
FILTER=
for arg in "$@"; do
test "x$FILTER" != x && FILTER="$FILTER|"
FILTER="$FILTER$arg"
done
test "x$FILTER" = "x" && FILTER=.
TESTS=`grep -r --include='*.py' -l -e doctest -e unittest * | grep -E "$FILTER"`
ret=0
FAILS=
for test in $TESTS; do
echo "Running tests in $test"
test=`echo "$test" | sed 's@[/\\]@.@g;s@[.]py$@@'`
if ! $PYTHON -m $test -v; then
ret=$((ret+1))
FAILS="$FAILS
$test"
fi
done
echo
echo "SUMMARY:"
if test $ret = 0; then
echo "All tests passed."
else
echo "$ret source file(s) had tests failing:$FAILS" >&2
fi
exit $ret