#!/bin/bash

[ -f tests/database.sqlite ] && rm tests/database.sqlite

export PYTHONPATH=`pwd`
export OG_SERVER_CONFIG='tests/config.py'
./db.py
./fill_data.py
./admin.py &
pid=$!

trap "cd .. && kill -9 $pid" EXIT SIGTERM

cd tests
export OG_SERVER_CONFIG='config.py'
python . $@

exit 0
