/
make_tests
executable file
·45 lines (37 loc) · 1.25 KB
/
make_tests
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# apt install python-nose-json python-nosehtmloutput python-nose-cov python-requests
# apt install python3-nose-json python3-nosehtmloutput python3-nose-cov python3-requests
# pip2 install nose NoseHTML nosehtmloutput nose-html nosehtmloutput-2 nose-json nose-cov
# pip3 install nose NoseHTML nosehtmloutput nose-html nosehtmloutput-2 nose-json nose-cov
VERSION="$1"
PATH_SCRIPT="$(cd $(/usr/bin/dirname $(which -- $0 || echo $0));pwd)"
PYTHONPATH=$PATH_SCRIPT/../../lib
export PYTHONPATH
function usage
{
echo "Usage : $0 2 # Python2 tests"
echo " $0 3 # Python3 tests"
exit 1
}
[[ -z $VERSION ]] && usage
[[ $VERSION -ne "2" && $VERSION -ne "3" ]] && usage
PATTERN=$(echo tests$VERSION\|tests-$VERSION)
NOSE=$(find /bin /usr/bin /usr/local/bin -type f -name \*nosetests\* | grep -E "$PATTERN"|tail -1)
[[ -z $NOSE ]] && {
echo "Error: nosetests for python $VERSION not found. exiting"
exit 1
}
(
cd $PATH_SCRIPT/../..
$NOSE \
--verbosity=2 \
--with-coverage \
--cover-html \
--cover-html-dir=$PATH_SCRIPT/../../tmp/cover \
--with-html-output \
--html-out-file=$PATH_SCRIPT/../../tmp/xunit.html \
--cover-package=.. \
--with-json \
--json-file=$PATH_SCRIPT/../../tmp/xunit.json \
lib/tests/
)