#!/bin/sh

set -e

runuser -u postgres -- psql -f $(pwd)/debian/tests/init.sql

cp -r tests settings.py ${AUTOPKGTEST_TMP}
cd ${AUTOPKGTEST_TMP}
for p in $(py3versions -s); do
    # test_introspect is new in 2.0.9 but currently requires
    # pytest-lazy-fixture, which was removed from Debian (see
    # https://bugs.debian.org/1076459).
    # https://github.com/SectorLabs/django-postgres-extra/commit/35ed1d2b12716fb9a14cf1d025383b225dd94382
    # removes this, but is too big to backport.  We can remove that --ignore
    # option with the next release.
    $p -m pytest --ds settings --ignore=tests/test_introspect.py --ignore=tests/test_management_command_partition.py
done
