#!/bin/sh
set -e -u

# Make the tests use the API specified
export QT_API=$1
export PYTEST_QT_API=$1

cp -r debian/run_tests qtconsole/tests "$AUTOPKGTEST_TMP"

cd "$AUTOPKGTEST_TMP"

for py in $(py3versions -s); do
    echo "Testing with $py (pytest call):"
    # give it five chances; PySide 6 is quite flaky
    xvfb-run -a -s "-screen 0 1024x768x24" \
        ./run_tests $py -m pytest -v --color=no --deselect tests/test_inprocess_kernel.py tests
    echo "Testing with $py (unittest call):"
    xvfb-run -a -s "-screen 0 1024x768x24" \
        $py -m unittest -v tests/test_inprocess_kernel.py
done
