#!/bin/bash
set -e

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

# qtwebengine is only supported on selected architectures
# skip qtwebengine tests if python3-pyqt5.qtwebengine is not available
if ! $( dpkg -s python3-pyqt5.qtwebengine | grep "Status:" | grep -q "install ok installed" ); then
  SKIP_TEST="not webengine and not test_isalive"
else
  SKIP_TEST="not test_isalive"
fi
export USE_CONDA=No

mkdir "$AUTOPKGTEST_TMP"/qtpy
cp pytest.ini "$AUTOPKGTEST_TMP"
cp -r qtpy/tests "$AUTOPKGTEST_TMP"/qtpy
PYS=$(py3versions -s)
for py in $PYS; do
  cd "$AUTOPKGTEST_TMP"
  echo "Testing with $py:"
  $py -m pytest -v -k "$SKIP_TEST"
done
