#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk
export SETUPTOOLS_SCM_PRETEND_VERSION=$(shell echo $(DEB_VERSION_UPSTREAM) | sed -e 's/\+.*//')
export SKIP_ARGS=not test_core_search_geodes \
and not test_core_serialize_deserialize_geodes_results \
and not test_plugins_search_geodes_normalize \
and not test_fetch_json \
and not test_core_object_creates_config_standard_location \
and not test_core_object_creates_locations_standard_location \
and not test_read_only_home_dir \
and not test_eoproduct_download_progress_bar \
and not test_all_requirements \
and not test_plugins_search_stac_list_assets_register_downloader_updates_assets

# Temporarily skip tests that are not compatile with jsonpath-ng v1.8 and v1.9
SKIP_ARGS+=\
and not test_core_import_stac_items_from_eodag_server \
and not test_core_import_stac_items_from_known_provider \
and not test_core_import_stac_items_from_unknown_provider \
and not test_core_serialize_deserialize_earth_search_results \
and not test_search_stac_static \
and not test_search_stac_static_by_cloudcover \
and not test_search_stac_static_by_date \
and not test_search_stac_static_by_geom \
and not test_search_stac_static_by_property \
and not test_plugins_search_dedl_discover_queryables \
and not test_plugins_search_stacsearch_default_geometry \
and not test_plugins_search_stacsearch_discover_queryables \
and not test_plugins_search_stacsearch_discover_queryables_datetime_split \
and not test_plugins_search_stacsearch_discover_queryables_merge \
and not test_plugins_search_stacsearch_discover_queryables_no_pattern_propagation \
and not test_plugins_search_stacsearch_mapping_earthsearch \
and not test_plugins_search_stacsearch_normalize_links \
and not test_plugins_search_stac_list_assets_register_downloader_request_error

export PYBUILD_TEST_ARGS=\
-k "${SKIP_ARGS}"  \
--ignore={dir}/tests/test_end_to_end.py \
{dir}/tests

%:
	dh $@ --buildsystem=pybuild

execute_after_dh_fixperms:
	chmod -x debian/python3-eodag/usr/lib/python*/dist-packages/eodag/resources/shp/ne_110m_admin_0_map_units.*
