# ## 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]]" CELERY_WORKER_OFF="You must run scripts/start_celery_workers.sh before running this test" if [ "$#" -eq 0 ]; then echo $USAGE_MSG exit fi ALERT_WORKER=`ps aux | grep "celery worker" | grep alert_listener` if [ "${#ALERT_WORKER}" -eq 0 ]; then echo $CELERY_WORKER_OFF exit fi 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