-
-
Notifications
You must be signed in to change notification settings - Fork 964
/
lib
32 lines (26 loc) · 1.01 KB
/
lib
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
# shell library to help executing tests
set -x
coverage erase
check() {
RET=$?
if [ $RET -ne 0 ] ; then
exit $RET
fi
}
run_coverage() {
# PendingDeprecationWarning is needed as long as we support Django 1.11
python -W default -W ignore:unclosed:ResourceWarning -W ignore::PendingDeprecationWarning -m coverage run --source . --append "$@"
}
cleanup_database() {
rm -f weblate.db
if [ $CI_DATABASE = "mysql" ] ; then
mysql --host=$CI_DB_HOST -e 'SET GLOBAL character_set_server=utf8' -uroot
mysql --host=$CI_DB_HOST -e 'SET GLOBAL collation_server=utf8_general_ci' -uroot
mysql --host=$CI_DB_HOST -e 'DROP DATABASE IF EXISTS weblate;' -uroot
mysql --host=$CI_DB_HOST -e 'CREATE DATABASE weblate CHARACTER SET utf8 COLLATE utf8_general_ci;' -uroot
fi
if [ $CI_DATABASE = "postgresql" ] ; then
psql --host=$CI_DB_HOST -c 'DROP DATABASE IF EXISTS weblate;' -U postgres
psql --host=$CI_DB_HOST -c 'CREATE DATABASE weblate;' -U postgres
fi
}