#!/bin/sh
set -e

pkg=qiime

if [ "${AUTOPKGTEST_TMP}" = "" ] ; then
  AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
  trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
fi

if [ "$(dpkg-architecture -q DEB_HOST_ARCH_BITS)" = "32" ] ; then
	exit 77
fi

# tests/test_conda_hooks.py locates the shell hooks relative to the tests
# directory, so the source layout has to be preserved.
cp -a hooks tests "${AUTOPKGTEST_TMP}"

cd "${AUTOPKGTEST_TMP}"

if [ ! -e /usr/bin/pytest-3 ] ; then
	echo "Please install package python3-pytest to run this script!"
	exit 1
fi

python3 -m pytest -v
