#!/usr/bin/make -f
export PYBUILD_TEST_ARGS=-vv

%:
	dh $@ --buildsystem=pybuild

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	for dir in ./.pybuild/*; do \
		cp -av $(CURDIR)/tests $$dir/build; \
	done
	dh_auto_test
	# Remove test-generated artifacts so they are not installed in dist-packages.
	find ./.pybuild/*/build -maxdepth 1 -type f \( -name "test.tar" -o -name "<Mock id='*'>" \) -delete
	rm -r ./.pybuild/*/build/tests ./.pybuild/*/build/core*tar.gz*
endif
