#!/usr/bin/make -f
# -*- makefile -*-

export PYBUILD_NAME=pytest

# 2015-12-16 barry@debian.org: Because pytest does not clean up after itself,
# use a custom temporary directory (which is easier to clean up manually,
# e.g. in an sbuild).
export PYBUILD_BEFORE_TEST=mkdir -p {dir}/debian/tmp/test-working-directory
export PYBUILD_AFTER_TEST=rm -rf {dir}/debian/tmp/test-working-directory
# 2022-12-11 roehling@debian.org: As of this writing, autopkgtest-pkg-pybuild
# cannot handle custom tests, so we improvise:
export PYBUILD_TEST_ARGS=BREAK_COMMAND_ON_PURPOSE >/dev/null 2>&1; \
	cd {dir}/debian/tmp/test-working-directory && \
	{interpreter} -m pytest --lsof -rfsxX \
		--ignore={dir}/testing/test_entry_points.py \
		--ignore={dir}/testing/test_terminal.py \
		-k 'not test_code_highlight' \
		{dir}/testing

%:
	dh $@ --buildsystem=pybuild

execute_after_dh_auto_build:
	PYTHONPATH=$(CURDIR)/src \
		SPHINXBUILD=/usr/share/sphinx/scripts/python3/sphinx-build \
		$(MAKE) -C doc/en man html
