#!/bin/sh
set -efu

pys="$(py3versions -s 2> /dev/null)"

# copy data files for autopkgtest
DATA_DIR="SoftLayer/fixtures"
DEST_DIR="/usr/lib/python3/dist-packages/SoftLayer/fixtures/"
echo $DEST_DIR
cp  ${DATA_DIR}/sample_vs_template.conf \
    ${DATA_DIR}/id_rsa.pub \
    ${DATA_DIR}/realtest.com $AUTOPKGTEST_TMP

cp -a tests setup.cfg "$AUTOPKGTEST_TMP"
cd "$AUTOPKGTEST_TMP"

ln -s $AUTOPKGTEST_TMP/sample_vs_template.conf ${DEST_DIR}
ln -s $AUTOPKGTEST_TMP/id_rsa.pub ${DEST_DIR}
ln -s $AUTOPKGTEST_TMP/realtest.com ${DEST_DIR}

for py in $pys; do
	echo "=== $py ==="
	$py -m pytest --verbose tests 2>&1
done
