#!/bin/sh
set -efu

export HOME="$AUTOPKGTEST_TMP"
export LC_ALL=C.UTF-8
export PYTHONPATH=/usr/share/beets

pythons="$(py3versions -s)"

cp -a test $AUTOPKGTEST_TMP
cd "$AUTOPKGTEST_TMP"

# The tests assume beetsplug is found above them, and do unspeakable evil with
# __path__ to ensure that their local beetsplug is used.
ln -s /usr/share/beets/beetsplug .

for python in $pythons; do
	echo "=== $python ==="
	$python -m unittest discover -p 'test_*' 2>&1
done
