fonttools/run-tests.sh

35 lines
640 B
Bash
Raw Normal View History

2015-03-03 09:57:41 -08:00
#!/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
# Setup environment
2015-04-07 18:26:13 -07:00
cd Lib
PYTHONPATH=".:$PYTHONPATH"
export PYTHONPATH
# Find tests
FILTER=$1
test "x$FILTER" = x && FILTER=.
TESTS=`grep -r --include='*.py' -l -e doctest -e unittest * | grep "$FILTER"`
ret=0
for test in $TESTS; do
echo "Running tests in $test"
2015-04-07 18:26:13 -07:00
test=`echo "$test" | sed 's@[/\\]@.@g;s@[.]py$@@'`
if ! $PYTHON -m $test -v; then
ret=$((ret+1))
fi
done
if test $ret != 0; then
echo "$ret source file(s) had tests failing" >&2
fi
exit $ret