Blame view

src/scripts/celery_test.sh 818 Bytes
fafae58f   haribo   Cleaned directory
1
2
3
4
5
6
7
8
9
10
#
## To be used for tests using celery (asynchronous)
## BEWARE : This script launches tests on the production database
#

#
## Usage : celery_test.sh app.tests[.ClassTest[.test_name]]
#

USAGE_MSG="Usage : celery_test.sh app.tests[.ClassTest[.test_name]]"
94082e77   haribo   Date: 03/06/2016
11
CELERY_WORKER_OFF="You must run scripts/start_celery_workers.sh before running this test"
fafae58f   haribo   Cleaned directory
12
13
14
15
16
17

if [ "$#" -eq 0 ]; then
    echo $USAGE_MSG
    exit
fi

94082e77   haribo   Date: 03/06/2016
18
19
20
21
22
23
24
ALERT_WORKER=`ps aux | grep "celery worker" | grep alert_listener`

if [ "${#ALERT_WORKER}" -eq 0 ]; then
    echo $CELERY_WORKER_OFF
    exit
fi

fafae58f   haribo   Cleaned directory
25
26
27
28
29
30
31
32
33
34
SCRIPT_PATH=$0
SCRIPT_PATH=${SCRIPT_PATH%/*}

cd $SCRIPT_PATH/..

sed -i -e "s/CELERY_TEST = False/CELERY_TEST = True/g" pyros/settings.py

python manage.py test "$@" --keepdb --nomigrations

sed -i -e "s/CELERY_TEST = True/CELERY_TEST = False/g" pyros/settings.py