#!/bin/sh

set -e -u

SOURCE_DIR="$(pwd)"

for py in $(py3versions -r 2>/dev/null); do
	# skip python3.8 while freezegun is broken (#944026)
	[ "$py" = "python3.8" ] && continue

	cd "$AUTOPKGTEST_TMP"
	# cleanup
	rm -vrf "$AUTOPKGTEST_TMP"/*
	# create a fresh copy of the tests
	cp -va "$SOURCE_DIR"/tests "$SOURCE_DIR"/pytest.ini "$AUTOPKGTEST_TMP"/
	# add test_schedule.py into a combined tests dir
	cp -va "$SOURCE_DIR"/tempora/tests/test_schedule.py "$AUTOPKGTEST_TMP"/tests/

	echo "Running testsuite with $py:"
	$py -m pytest tests
done
