#!/bin/sh

set -e

cp -a lib/tests ${AUTOPKGTEST_TMP}

cd ${AUTOPKGTEST_TMP}

find . -path "*/payloads/Test.proto" \
    -exec sh -c 'protoc --python_out=$(dirname {}) {}' \;

for p in $(py3versions -s); do
    echo
    echo "**************************"
    echo "*** Testing with ${p}"
    echo "**************************"
    echo
    $p -m pytest -sv -k "not test_proto_import_examples" tests
    rm -rf .pytest_cache
done

exit 0
