#!/usr/bin/make -f
export PYBUILD_NAME=narwhals

# Ignore a test that fails with an invalid timezone
FAILING_TEST_WRONG_TIMEZONE=test_tz_aware

# Ignore tests that fail when using pyarrow with non-default python version,
# because pyarrow.lib is only built for the default python version
SEGFAULT_TESTS_PYARROW=test_nested_structures or test_slice_both_tuple or \
test_slice_slice_columns or \
test_get_item_works_with_tuple_and_list_and_range_row_and_col_indexing or \
test_get_item_works_with_tuple_and_list_and_range_row_indexing_and_slice_col_indexing \
or test_get_item_works_with_tuple_and_list_indexing_and_str or \
test_namespace_series_from_iterable or test_series_from_iterable or \
test_scatter or test_to_native_namespace or test_from_dict or test_from_dicts \
or test_from_numpy or test_series_from_numpy_dtype or test_dataframe_from_numpy \
or test_series_from_numpy or test_dataframe_from_dict

# Ignore tests that fail due to metadata info not being available before package
# installation
FAILING_TEST_SYSTEM_INFO=test_get_sys_info or test_get_deps_info or \
test_show_versions
FAILING_TEST_METADATA=test_package_version or test_package_getattr

# Merge all failing tests with an or
PYTEST_EXCLUDE=$(FAILING_TEST_WRONG_TIMEZONE) or $(SEGFAULT_TESTS_PYARROW) or \
$(FAILING_TEST_SYSTEM_INFO) or $(FAILING_TEST_METADATA)

export PYBUILD_TEST_ARGS=-k "not ($(PYTEST_EXCLUDE))"

%:
	dh $@ --buildsystem=pybuild

override_dh_auto_install:
	dh_auto_install
	# remove .hypothesis folders generated while testing
	rm -rf debian/python3-narwhals/usr/lib/python3*/dist-packages/.hypothesis
