From 6643e6dbe3bc96448740fc084cee056c965e4ff9 Mon Sep 17 00:00:00 2001 From: Sylvain Brunato Date: Fri, 10 Jan 2025 12:20:35 +0100 Subject: [PATCH 1/2] fix(crunch): skip missing key in filter_property --- eodag/plugins/crunch/filter_property.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/eodag/plugins/crunch/filter_property.py b/eodag/plugins/crunch/filter_property.py index e699828ea..ff83812c3 100644 --- a/eodag/plugins/crunch/filter_property.py +++ b/eodag/plugins/crunch/filter_property.py @@ -78,10 +78,9 @@ def proceed( for product in products: if property_key not in product.properties.keys(): logger.warning( - "%s not found in product.properties, filtering disabled.", - property_key, + f"{property_key} not found in {product}.properties, product skipped", ) - return products + continue if operator_method(product.properties[property_key], property_value): add_to_filtered(product) From 7551b8e0b3b4fef7b73d2e5533beadcfadd35d40 Mon Sep 17 00:00:00 2001 From: Sylvain Brunato Date: Fri, 10 Jan 2025 12:20:49 +0100 Subject: [PATCH 2/2] test: skip missing key in filter_property --- tests/integration/test_search_stac_static.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/integration/test_search_stac_static.py b/tests/integration/test_search_stac_static.py index 21e7a3c06..dfc1fef86 100644 --- a/tests/integration/test_search_stac_static.py +++ b/tests/integration/test_search_stac_static.py @@ -382,6 +382,11 @@ def test_search_stac_static_crunch_filter_property(self): ) self.assertEqual(len(filtered_items), 1) + with self.assertLogs(level="WARNING") as cm: + filtered_items = items.filter_property(foo="bar") + self.assertIn("foo not found in EOProduct", str(cm.output)) + self.assertEqual(len(filtered_items), 0) + @mock.patch( "eodag.api.core.EODataAccessGateway.fetch_product_types_list", autospec=True )