#!/bin/bash
set -e

pkg="paleomix"

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

cp -a /usr/share/doc/${pkg}/tests $ADTTMP

cd $ADTTMP

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
nosetests --with-coverage --cover-erase --cover-inclusive --cover-tests --cover-package paleomix .