#!/bin/bash
set -e

pkg=python3-neo

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

# Note that as of neo 0.11.1, example scripts have not been ported to the newer
# neo API, hence testing with the source code unit test for now.
export NOSETESTS_NO_NETWORK=1
export HOME="$AUTOPKGTEST_TMP/home"

mkdir -v "$HOME"
cp -rv neo/ "$AUTOPKGTEST_TMP"
for PYTHON3 in $(py3versions --supported)
do
	echo "I: Running Neo unittests using $PYTHON3"
	NOSETESTS_NO_NETWORK=1 "$PYTHON3" -m pytest -v neo
done
