#!/bin/sh
set -C -e -f -u

# This script must be executed in the source tree.  It runs the
# upstream test suite tests/test.py.

# The latter insists on writing various files, so we need to run it in
# a writable directory: AUTOPKGTEST_TMP/tests_tmp. Cleaning it is
# the responsibility of the caller.

# When called by debian/rules, . is writable, AUTOPKGTEST_TMP=. and "tests.py"
# will find the local version of taskcoachlib in ...

# When called by autopkg-test or sadt, . may not be writable and
# "tests.py" will not find taskcoachlib in .., so it will use the
# system-wide installed version.

cp --archive tests "$AUTOPKGTEST_TMP/tests_tmp"
cd "$AUTOPKGTEST_TMP/tests_tmp"
LC_ALL=en_US.utf8 \
 xvfb-run \
 python test.py --verbose --integrationtests --unittests
