#!/usr/bin/make -f

export PYBUILD_NAME=django-invitations
export PYBUILD_TEST_PYTEST=1

%:
	dh $@ --buildsystem=pybuild

override_dh_auto_clean:
	dh_auto_clean
	rm -rf django_invitations.egg-info/

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	$(eval BUILD_DIR=$(shell pybuild --print '{build_dir}'))
	for dir in $(BUILD_DIR); do \
		cp -r $(CURDIR)/test_* $$dir; \
		cd $$dir; \
		python3 -mpytest --ignore=$(CURDIR)/tests/allauth/  --ds=test_settings $(CURDIR)/tests; \
		python3 -mpytest --ignore=$(CURDIR)/tests/basic/  --ds=test_allauth_settings $(CURDIR)/tests; \
		rm $$dir/test_* ; \
	done
endif
