#! /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
	start-stop-daemon --start --background --pidfile $($@TEMPDIR)/influxdb.pid --exec /usr/bin/influxd -- -config $($@TEMPDIR)/influxdb.conf -pidfile $($@TEMPDIR)/influxdb.pid
	dh_auto_test
	pkill -F $($@TEMPDIR)/influxdb.pid
	rm -r $($@TEMPDIR)
