#!/bin/bash 
set -e

# skip test_development_guidelines_matches_ci because
# we're installed, so the path doesn't match development
SKIP_TESTS=test_development_guidelines_matches_ci
# See https://github.com/dask/dask/issues/10418
# only seems to fail in autopkgtests, which have
# fewer dependencies installed
SKIP_TESTS="$SKIP_TESTS or test_division_or_partition"

cp conftest.py "$AUTOPKGTEST_TMP"
for py in $(py3versions --supported)
do
  cd "$AUTOPKGTEST_TMP"
  # pyarrow (and thus most dataframe tests) is only built for the default
  # Python version; newer interpreters like 3.15 have no pyarrow module.
  if ! $py -c "import pyarrow" >/dev/null 2>&1; then
    echo "Skipping $py: pyarrow is not importable for this interpreter"
    continue
  fi
  echo "Testing with $py:"
  # array_expr tests need array query-planning, which Debian does not use;
  # deselect them like the build-time test suite in debian/rules does.
  http_proxy= $py -m pytest \
            --timeout-method=signal \
            --timeout=300 \
            -k "not ( ${SKIP_TESTS} )" \
            -m "not (network) and not array_expr" -v \
            --pyargs dask
done
