#!/bin/sh
set -e -u

export QT_QPA_PLATFORM=offscreen

# 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:"
    # give it five chances; PySide 6 is quite flaky
    xvfb-run -a -s "-screen 0 1024x768x24" \
        ./run_tests $py -m pytest -v --color=no -k "not test_other_output" tests
done
