#!/bin/sh

set -e

# ensure temporary directory exists
if [ -z "$AUTOPKGTEST_TMP" ] ; then
  AUTOPKGTEST_TMP=$( mktemp -d )
fi

# setup test environment
cp -r tests.py "$AUTOPKGTEST_TMP/"
cp -r conftest.py "$AUTOPKGTEST_TMP/"
cd "$AUTOPKGTEST_TMP"

# upstream provides unit tests, but some have the local source hardcoded,
# while we want to test the installed package
sed -e "s_anonip.py_/usr/bin/anonip_" -i tests.py

for py in $(py3versions -s); do
    $py -Wd -m pytest -r a -vv tests.py 2>&1;
done

