find $PYTEST_DIR -name '*.pyc' -delete
echo "Usage: run_python_tests.sh [--on-local-xserver]"
echo "--on-local-xserver"
echo " all tests are run on local X-server. "
echo " User can see test in action."
echo " Any interaction (mouse, keyboard) should be avoided"
echo " By default without arguments script runs pytest on virtual X serverf."
if [ ! -d $PYTEST_DIR ]; then
echo "Script should be run from top directory in repository"
if [ "$1" != "--on-local-xserver" ]; then
Xvfb $DISPLAY -screen 0 1280x1024x24 &
KILL_DELAY=$(($DELAY + 30))
timeout -k $KILL_DELAY $DELAY pytest --timeout=10 ./tests/tools
[ $use_xvfb = 1 ] && pkill -9 Xvfb
[ "$1" = "--help" -o "$1" = "-h" ] && print_help