~juhana-jauhiainen/software-center/fix-for-737697

2038 by Michael Vogt
* pyflakes fixes
1
#!/bin/sh
2
3
set -e
4
2062 by Michael Vogt
* test/test-all.sh:
5
if [ ! -x /usr/bin/python-coverage ]; then
6
    echo "please install python-coverage"
7
    exit 1
8
fi
9
10
if [ ! -x /usr/bin/xvfb-run ]; then
11
    echo "please install xvfb"
12
    exit 1
13
fi
14
15
if ! python -c 'import mock'; then
16
    echo "please install python-mock"
17
    exit 1
18
fi
19
2655 by Michael Vogt
test/test-all.sh: add another test dependency
20
if ! python -c 'import unittest2'; then
21
    echo "please install python-unittest2"
22
    exit 1
23
fi
24
2653 by Michael Vogt
test/test-all.sh: add some more test dependencies
25
if ! python -c 'import aptdaemon.test'; then
26
    echo "please install python-aptdaemon.test"
27
    exit 1
28
fi
29
30
if ! python -c 'import lxml'; then
31
    echo "please install python-lxml"
32
    exit 1
33
fi
34
35
if ! python -c 'import PyQt4'; then
36
    echo "please install python-qt4"
37
    exit 1
38
fi
39
2062 by Michael Vogt
* test/test-all.sh:
40
41
# clear coverage data
42
# coverage erase will not erase the files from --parallel-mode 
2075 by Michael Vogt
test/test-all.sh: do not fail if no .coverage file is there
43
rm -f .coverage*
2062 by Michael Vogt
* test/test-all.sh:
44
45
# run with xvfb and coverage
46
PYTHON="python-coverage run --parallel-mode"
47
#PYTHON="xvfb-run $PYTHON"
48
49
# and record failures here
2038 by Michael Vogt
* pyflakes fixes
50
OUTPUT="./output"
51
rm -rf $OUTPUT
52
53
FAILED=""
54
FILES=$(find . -name 'test_*.py')
55
for file in $FILES; do 
56
    if [ -f $file ]; then
57
	echo -n "Testing $file"
58
        mkdir -p ${OUTPUT}/$(dirname $file)
2062 by Michael Vogt
* test/test-all.sh:
59
	if ! $PYTHON $file  >output/$file.out 2>&1 ; then
2038 by Michael Vogt
* pyflakes fixes
60
	    FAILED="$FAILED $file"
61
	    echo " FAIL"
62
	else 
2543 by Michael Vogt
test fixes, remove unused/broken ReviewsJsonLoader code, some pyflakes fixes
63
            echo " success"
2038 by Michael Vogt
* pyflakes fixes
64
	    rm -f ${OUTPUT}/$file.out; 
65
	fi 
66
    fi 
67
done; 
68
2062 by Michael Vogt
* test/test-all.sh:
69
# gather the coverage data
2116 by Michael Vogt
split the coverage generation into its own script
70
./gen-coverage-report.sh
2062 by Michael Vogt
* test/test-all.sh:
71
2038 by Michael Vogt
* pyflakes fixes
72
if [ -n "$FAILED" ]; then 
73
    echo "FAILED: $FAILED"; 
74
    echo "Check ${OUTPUT}/ directory for the details"; 
75
    exit 1; 
76
fi
2062 by Michael Vogt
* test/test-all.sh:
77