Skip to content
Snippets Groups Projects
run_tests 1.08 KiB
Newer Older
Vincent Hatakeyama's avatar
Vincent Hatakeyama committed
#!/bin/zsh
# vim: set shiftwidth=4 softtabstop=4:
#
# This script is used to run tests on a database with demo data installed.
#
# Either provide the name of the database (first argument) or it will default to <project>_test
here=$(dirname $0)
project_home=$(cd $here && cd .. && echo $PWD)
tested_modules=$(python -B -c "import ConfigParser ; c = ConfigParser.ConfigParser() ; c.read('${project_home}/setup.cfg') ; print ','.join(c.get('odoo_scripts', 'module_list_tests', '').split())")
if [[ "$tested_modules" != "" ]];
then 
    update="-u $tested_modules"
fi
Vincent Hatakeyama's avatar
Vincent Hatakeyama committed
dbname=$1
if [[ -z "$dbname" ]];
then
Vincent Hatakeyama's avatar
Vincent Hatakeyama committed
else
Vincent Hatakeyama's avatar
Vincent Hatakeyama committed
fi
ODOO_TYPE=$(python -B -c "import ConfigParser ; c = ConfigParser.ConfigParser() ; c.read('${project_home}/setup.cfg') ; print c.get('odoo_scripts', 'odoo_type', 'odoo8')")
if [ "$ODOO_TYPE" = "odoo8" ];
then
    loglevel="--log-level=info"
else
    loglevel="--log-level=test"
fi
$here/start $update -d $dbname --test-enable $loglevel --max-cron=0 --stop-after-init $*