#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk
include /usr/share/dpkg/architecture.mk

export SETUPTOOLS_SCM_PRETEND_VERSION=${DEB_VERSION_UPSTREAM}
export PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
PYBUILD_TEST_ARGS = tests

ifneq ($(PYBUILD_AUTOPKGTEST),1)
PYBUILD_TEST_ARGS += --ignore=tests/test_sockets.py
endif

ifeq ($(DEB_HOST_ARCH),arm64)
PYBUILD_TEST_ARGS += --deselect=tests/test_to_process.py::test_identical_sys_path[asyncio+uvloop]
endif
ifeq ($(DEB_HOST_ARCH),armel)
PYBUILD_TEST_ARGS += --deselect=tests/test_from_thread.py::TestRunAsyncFromThread::test_run_sync_from_thread_pooling
endif
ifeq ($(DEB_HOST_ARCH),loong64)
PYBUILD_TEST_ARGS += --deselect=tests/test_pytest_plugin.py::test_keyboardinterrupt_during_test
endif
ifeq ($(DEB_HOST_ARCH),ppc64el)
PYBUILD_TEST_ARGS += --deselect=tests/test_from_thread.py::TestRunAsyncFromThread::test_run_sync_from_thread_pooling --deselect=tests/test_to_thread.py::TestBlockingPortalProvider::test_single_thread[asyncio]
endif
ifeq ($(DEB_HOST_ARCH),riscv64)
PYBUILD_TEST_ARGS += --deselect=tests/test_pytest_plugin.py::test_keyboardinterrupt_during_test
endif
ifeq ($(DEB_HOST_ARCH),s390x)
PYBUILD_TEST_ARGS += --deselect=tests/test_to_thread.py::test_run_in_custom_limiter[asyncio+uvloop] --deselect=tests/test_to_thread.py::test_run_in_custom_limiter[trio]
endif

export PYBUILD_TEST_ARGS

%:
	dh $@ --buildsystem=pybuild

execute_after_dh_auto_clean:
	rm -rf src/anyio.egg-info/
