anki/tools/tests.sh

32 lines
650 B
Bash
Raw Normal View History

#!/bin/bash
2012-12-21 12:17:31 +01:00
#
# Usage:
# tools/tests.sh # run all tests
# tools/tests.sh decks # test only test_decks.py
# coverage=1 tools/tests.sh # run with coverage test
2015-12-02 08:02:42 +01:00
BIN="$(cd "`dirname "$0"`"; pwd)"
export PYTHONPATH=${BIN}/..:${PYTHONPATH}
2018-10-04 09:56:50 +02:00
# favour nosetests3 if available
nose=nosetests
if which nosetests3 >/dev/null 2>&1; then
nose=nosetests3
fi
2012-12-21 12:17:31 +01:00
dir=.
if [ x$1 = x ]; then
lim="tests"
else
2012-12-21 12:17:31 +01:00
lim="tests.test_$1"
fi
if [ x$coverage != x ]; then
args="--with-coverage"
else
args=""
echo "Call with coverage=1 to run coverage tests"
fi
2018-10-04 09:56:50 +02:00
(cd $dir && $nose -vs --processes=16 --process-timeout=300 $lim $args --cover-package=anki)