#!/bin/sh
# Run the upstream pytest suite against the installed package.
set -eu

cp -a tests "$AUTOPKGTEST_TMP/"
cd "$AUTOPKGTEST_TMP"

export DJANGO_SETTINGS_MODULE=tests.settings
export PYTHONPATH="$PWD"

# test_template_exists in test_logic.py asserts that
# `$PWD/django_json_widget/templates/...` exists, which is only true when
# pytest is run from an upstream source checkout. In autopkgtest the package
# is installed system-wide and there is no such directory next to the tests,
# so the assertion is meaningless here -- skip just this one case.
python3 -m pytest -v tests \
    --deselect 'tests/test_logic.py::JSONEditorWidgetTemplateRenderingTests::test_template_exists'
