#!/usr/bin/make -f

XVFB_OPTS=--auto-servernum --server-num=20 -s "-screen 0 1024x768x24 -ac +extension GLX +render -noreset"

EXCLUDED_TESTS :=
# Non-interactive tests
EXCLUDED_TESTS += not interactive
# PulseAudio related
EXCLUDED_TESTS += and not PulseAudio
EXCLUDED_TESTS += and not test_pulse
EXCLUDED_TESTS += and not test_player_play
EXCLUDED_TESTS += and not test_player_play_multiple
# test suite just stops
EXCLUDED_TESTS += and not test_player_silent_audio_driver

# Failing for unknown reason but looks harmless
EXCLUDED_TESTS += and not test_freetype_face
# These ones are failing in cowbuilder
# Fonts are related to missing "arial" font which is normal
# Driver one looks being related to not having ALSA stuff
EXCLUDED_TESTS += and not test_fontconfig
EXCLUDED_TESTS += and not test_linux_fontconfig
EXCLUDED_TESTS += and not test_driver
# Can't test openal in cowbuilder
EXCLUDED_TESTS += and not test_openal
# cf. #929697
EXCLUDED_TESTS += and not ClockTimingTestCase

export PYBUILD_NAME=pyglet
export PYBUILD_TEST_PYTEST=1
export PYBUILD_TEST_ARGS=>/dev/null 2>&1; cd {build_dir}; xvfb-run $(XVFB_OPTS) python{version} -m pytest -v -k "$(EXCLUDED_TESTS)"

%:
	dh $@ --with python3 --buildsystem=pybuild

override_dh_auto_clean:
	dh_auto_clean

	rm -fr .pytest_cache/
