#!/bin/sh
set -e

cd ${AUTOPKGTEST_TMP}

for modulename in nwdiag rackdiag packetdiag ; do
    for py in `py3versions -s` ; do
        echo "testing module ${modulename} with interpreter ${py}"
        ln -s /usr/lib/python3/dist-packages/${modulename}/tests ${AUTOPKGTEST_TMP}/tests
        ${py} -m pytest ${AUTOPKGTEST_TMP}/tests
        # because the modules share test (file)names, they need to not share cache
        rm -rf ${AUTOPKGTEST_TMP}/tests .pytest_cache
    done
done