#!/bin/sh
set -e
# See https://github.com/agronholm/anyio/issues/823: some tests fail
# on three archs, either flakily or consistently
arch=$(dpkg --print-architecture)
case $arch in
    armel)
	deselects="--deselect=tests/test_from_thread.py::TestRunAsyncFromThread::test_run_sync_from_thread_pooling"
	;;
    ppc64el)
	deselects="--deselect=tests/test_from_thread.py::TestRunAsyncFromThread::test_run_sync_from_thread_pooling --deselect=tests/test_to_thread.py::TestBlockingPortalProvider::test_single_thread[asyncio]"
	;;
    riscv64)
	deselects="--deselect=tests/test_pytest_plugin.py::test_keyboardinterrupt_during_test"
	;;
    *)
	deselects=""
	;;
esac

for PY in $(py3versions -s)
do
    echo "Testing with $PY"
    $PY -m pytest --verbose -W ignore $deselects 2>&1
done
