41
43
# clear coverage data
42
# coverage erase will not erase the files from --parallel-mode
44
# coverage erase will not erase the files from --parallel-mode
45
rm -f $TESTS_DIR/.coverage*
45
47
# run with xvfb and coverage
46
PYTHON="python-coverage run --parallel-mode"
47
#PYTHON="xvfb-run $PYTHON"
50
XVFB=$(which xvfb-run)
52
XVFB_CMDLINE="$XVFB -a"
56
COVERAGE=$(which python-coverage)
57
if [ $COVERAGE ]; then
58
# If you are measuring coverage in a multi-process program, or across a
59
# number of machines, you’ll want the --parallel-mode switch to keep the
60
# data separate during measurement. See Combining data files below.
61
# COVERAGE_CMDLINE="$COVERAGE run --parallel-mode"
62
echo "No coverage for now."
65
PYTHON="$XVFB_CMDLINE $COVERAGE_CMDLINE python -m unittest"
49
67
# and record failures here
68
OUTPUT=$TESTS_DIR"/output"
54
FILES=$(find . -name 'test_*.py')
55
for file in $FILES; do
57
echo -n "Testing $file"
58
mkdir -p ${OUTPUT}/$(dirname $file)
59
if ! $PYTHON $file >output/$file.out 2>&1 ; then
60
FAILED="$FAILED $file"
64
rm -f ${OUTPUT}/$file.out;
71
# run the requested tests if arguments were given,
72
# otherwise run the whole suite
73
# example of custom params (discover all the tests under the tests/gtk3 dir):
75
# ./run-tests.sh discover -v -s tests/gtk3/
77
# See http://docs.python.org/library/unittest.html#test-discovery
80
RUN_TESTS="$PYTHON $@"
82
RUN_TESTS="$PYTHON discover -v -c -b"
85
echo "Running the command: $RUN_TESTS"
69
88
# gather the coverage data
70
./gen-coverage-report.sh
72
if [ -n "$FAILED" ]; then
73
echo "FAILED: $FAILED";
74
echo "Check ${OUTPUT}/ directory for the details";
89
#./gen-coverage-report.sh