forked from mytardis/mytardis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
64 lines (59 loc) · 1.57 KB
/
test.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
#!/bin/bash
if [ -v EXTRA_REQS ]; then
pip install $EXTRA_REQS
fi
# select test to run with TEST_TYPE, memory pg mysql pylint
# only memory will include coverage for now
function run_test {
if [ "$2" == "coverage" ]; then
TEST_ARGS="--with-coverage --cover-package=tardis $TEST_ARGS"
fi
python test.py test --settings=$1 $TEST_ARGS
result=$?
if [ "$2" == "coverage" ]; then
if [ -n "$PULL_REQUEST_NUMBER" ]; then
export TRAVIS_PULL_REQUEST=$PULL_REQUEST_NUMBER;
else export TRAVIS_PULL_REQUEST='false'; fi
if [ -v COVERALLS_REPO_TOKEN ]; then
coveralls
fi
if [ -v CODACY_PROJECT_TOKEN ]; then
coverage xml
python-codacy-coverage -r coverage.xml
fi
fi
return $result
}
case "$TEST_TYPE" in
memory)
run_test tardis.test_settings coverage
(( exit_status = exit_status || $? ))
;;
pg)
run_test tardis.test_on_postgresql_settings
(( exit_status = exit_status || $? ))
;;
mysql)
run_test tardis.test_on_mysql_settings
(( exit_status = exit_status || $? ))
;;
pylint)
pylint --rcfile .pylintrc tardis
(( exit_status = exit_status || $? ))
;;
behave)
python mytardis.py behave --settings=tardis.test_settings
(( exit_status = exit_status || $? ))
;;
*)
run_test tardis.test_settings coverage
(( exit_status = exit_status || $? ))
run_test tardis.test_on_postgresql_settings
(( exit_status = exit_status || $? ))
run_test tardis.test_on_mysql_settings
(( exit_status = exit_status || $? ))
pylint --rcfile .pylintrc tardis
(( exit_status = exit_status || $? ))
;;
esac
exit $exit_status