#!/bin/bash
set -e

pkg="paleomix"

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

cp -a /usr/share/doc/${pkg}/tests $AUTOPKGTEST_TMP
cp -a /usr/share/doc/${pkg}/README.rst $AUTOPKGTEST_TMP

cd $AUTOPKGTEST_TMP

for gz in `find . -name "*.gz"` ; do
    # fasta_file.fasta.gz needs to stay compressed for testing
    if ! echo $gz | grep fasta_file.fasta.gz ; then
        gunzip $gz
    fi
done

## tox needs to run in source dir and relies on files only available in full source
# tox
## so rather run some test that is part of the tox test suite
pytest-3
