-
Notifications
You must be signed in to change notification settings - Fork 4
/
runtests.sh
executable file
·73 lines (63 loc) · 1.47 KB
/
runtests.sh
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#! /bin/bash
do_coverage=false
do_report=false
do_html=false
do_no_numba=false
# get the directory the script lives in and cd to it, might want this variable for later additions
homedir="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$homedir"
# parse arguments
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
--coverage)
do_coverage=true
;;
--no-numba)
do_no_numba=true
;;
--report)
do_report=true
;;
--html)
do_html=true
;;
--help)
echo "runtests.sh [--coverage] [--report] [--html] [--no-numba] [--help] FILES*"
exit 0
;;
*)
# don't eat any file names passed on the command line
break
;;
esac
shift
done
# run tests and other coverage operations if requested
if [ $do_coverage = true ]
then
rm -f .coverage coverage.xml
coverage run --omit=tests/*.py --branch -m unittest -c $*
result=$?
if [ $do_no_numba = true ]
then
echo "Running tests again without Numba"
USE_NUMBA=false coverage run --append --omit=tests/*.py --branch -m unittest -c $*
((result=$result + $?))
fi
coverage xml
if [ $do_report = true ]
then
coverage report
fi
if [ $do_html = true ]
then
rm -rf htmlcov
coverage html
fi
else
python -m unittest -c $*
result=$?
fi
exit $result