#! /usr/bin/make -f

export PYBUILD_NAME=aioinflux
%:
	dh $@ --with python3 --buildsystem=pybuild

override_dh_auto_test:
	$(eval $@TEMPDIR := $(shell mktemp -d))
	sed "s%@TEMPDIR@%$($@TEMPDIR)%" debian/test.conf.in > $($@TEMPDIR)/influxdb.conf
	influxd -config $($@TEMPDIR)/influxdb.conf & echo $$! > $($@TEMPDIR)/influxdb.pid
	sleep 5
	dh_auto_test
	pkill -F $($@TEMPDIR)/influxdb.pid
	rm -r $($@TEMPDIR)
