#!/bin/sh
set -e

# Save source directory
SRCDIR="$(pwd)"

cd "$AUTOPKGTEST_TMP"

# Copy tests to temp directory to avoid importing from source tree
cp -r "$SRCDIR/tests" "$AUTOPKGTEST_TMP/"

# Test all supported Python versions
for py in $(py3versions -s); do
    # Run all tests from temp directory (ensures pyrle is imported from installed package)
    # Use -n auto to parallelize across all available CPU cores using pytest-xdist
    $py -m pytest -v -n auto tests/
done
