#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export PYBUILD_NAME=django-health-check
export DJANGO_SETTINGS_MODULE=tests.testapp.settings

# Don't run integration tests.
export PYBUILD_TEST_ARGS := -m 'not integration'
# These tests require DNS, which may not be available during a build.
PYBUILD_TEST_ARGS += \
  --deselect tests/test_checks.py::TestDNS::test_run_check__dns_working \
  --deselect tests/test_checks.py::TestDNSExceptionHandling::test_check_status__no_answer \
  --deselect tests/test_checks.py::TestDNSExceptionHandling::test_check_status__no_nameservers \
  --deselect tests/test_checks.py::TestDNSExceptionHandling::test_check_status__nonexistent_hostname \
  --deselect tests/test_checks.py::TestDNSExceptionHandling::test_check_status__not_a_nameserver \
  --deselect tests/test_checks.py::TestDNSExceptionHandling::test_check_status__timeout
# These tests fail for unclear reasons.
PYBUILD_TEST_ARGS += \
  --deselect tests/contrib/test_redis.py::TestRedis::test_redis__labels_cluster_client \
  --deselect tests/contrib/test_redis.py::TestRedis::test_redis__repr_cluster_client

%:
	dh $@ --buildsystem=pybuild

execute_after_dh_python3:
	# Get rid of extra coverage files
	rm -f debian/*/usr/lib/python3/dist-packages/.coverage debian/*/usr/lib/python3/dist-packages/coverage.xml
