#!/bin/sh

# Exit on error
set -e

# Copy the compiled bootloader from the installed package to the auotpkgtest directory.
cp -R /usr/lib/python3/dist-packages/PyInstaller/bootloader/ PyInstaller/

# Run the upstream tests using 8 parallel threads.
# Disable the tests that don't currently work.
# * TestFunctions.test_find_module requires modulegraph, which isn't currently packaged in Debian.  TODO:  Possibly.  Other modulegraph tests succeed.
# * test_user_preferred_locale fails with a locale error, possibly because the build environment might force a default locale.
# * test_scapy3 fails with an import error.  It might be fixed once pyinstaller-hooks-contrib is packaged.
# * test_Qt_QTranslate fails for a currently unknown reason (an assertion error).  It might be fixed when pyinstaller-hooks-contrib is packaged.
# * test_multiprocessing.py currently fails.  <https://github.com/pyinstaller/pyinstaller/issues/8824#issuecomment-4226309425>  It should be fixed for pyinstaller 6.20.0.
for p in $(py3versions -s); do \
    $p -m pytest tests -n 8 -k "not test_find_module \
    and not test_Qt_QTranslate \
    and not test_scapy3 \
    and not test_user_preferred_locale \
    and not test_multiprocessing.py"; \
done