#!/bin/sh

set -e -u

cp -a tests pyproject.toml "${AUTOPKGTEST_TMP}"

for py3vers in $(py3versions -s); do
    echo
    echo "***************************"
    echo "*** Testing with ${py3vers}"
    echo "***************************"
    echo
    cd ${AUTOPKGTEST_TMP} && \
        echo "Content of current working folder:\n" && \
        ls -la && \
        echo "Running tests...\n" && \
        ${py3vers} -m pytest -s \
        -m "not network" \
        -k "not test_client_decode_text_using_autodetect \
        and not test_client_decode_text_using_explicit_encoding \
        and not test_logging_redirect_chain \
        and not test_logging_request \
        and not test_response_decode_text_using_autodetect" && \
        rm -rf .*_cache || exit 1
done

echo

exit 0
