diff --git a/eodag/api/product/metadata_mapping.py b/eodag/api/product/metadata_mapping.py index 7f05a1773..76e6fb00d 100644 --- a/eodag/api/product/metadata_mapping.py +++ b/eodag/api/product/metadata_mapping.py @@ -266,7 +266,7 @@ def convert_to_rounded_wkt(value): @staticmethod def convert_to_bounds_lists(input_geom): if isinstance(input_geom, MultiPolygon): - geoms = [geom for geom in input_geom] + geoms = [geom for geom in input_geom.geoms] # sort with larger one at first (stac-browser only plots first one) geoms.sort(key=lambda x: x.area, reverse=True) return [list(x.bounds[0:4]) for x in geoms] diff --git a/tests/test_cli.py b/tests/test_cli.py index 5087596a2..c25440943 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -35,6 +35,7 @@ download, eodag, search_crunch, + setup_logging, ) from tests.units.test_core import TestCore from tests.utils import mock, no_blanks @@ -52,9 +53,15 @@ def user_conf(self, conf_file="user_conf.yml", content=b"key: to unused conf"): yield conf_file def setUp(self): + super(TestEodagCli, self).setUp() self.runner = CliRunner() self.faker = Faker() + def tearDown(self): + super(TestEodagCli, self).tearDown() + # Default logging: no logging but still displays progress bars + setup_logging(1) + def test_eodag_without_args(self): """Calling eodag without arguments should print help message""" result = self.runner.invoke(eodag) diff --git a/tests/units/test_core.py b/tests/units/test_core.py index cae20dee7..282382a44 100644 --- a/tests/units/test_core.py +++ b/tests/units/test_core.py @@ -402,7 +402,7 @@ def test_get_geometry_from_various_only_locations(self): locations_config, locations=dict(country="FRA") ) self.assertIsInstance(geom_france, MultiPolygon) - self.assertEqual(len(geom_france), 3) # France + Guyana + Corsica + self.assertEqual(len(geom_france.geoms), 3) # France + Guyana + Corsica def test_get_geometry_from_various_locations_with_wrong_location_name_in_kwargs( self, @@ -437,7 +437,7 @@ def test_get_geometry_from_various_only_locations_regex(self): locations_config, locations=dict(country="PA[A-Z]") ) self.assertIsInstance(geom_regex_pa, MultiPolygon) - self.assertEqual(len(geom_regex_pa), 2) + self.assertEqual(len(geom_regex_pa.geoms), 2) def test_get_geometry_from_various_locations_no_match_raises_error(self): """If the location search doesn't match any of the feature attribute a ValueError must be raised""" @@ -461,7 +461,7 @@ def test_get_geometry_from_various_geometry_and_locations(self): ) self.assertIsInstance(geom_combined, MultiPolygon) # France + Guyana + Corsica + somewhere over Poland - self.assertEqual(len(geom_combined), 4) + self.assertEqual(len(geom_combined.geoms), 4) geometry = { "lonmin": 0, "latmin": 50, @@ -473,7 +473,7 @@ def test_get_geometry_from_various_geometry_and_locations(self): ) self.assertIsInstance(geom_combined, MultiPolygon) # The bounding box overlaps with France inland - self.assertEqual(len(geom_combined), 3) + self.assertEqual(len(geom_combined.geoms), 3) class TestCoreSearch(unittest.TestCase): diff --git a/tests/units/test_safe_build.py b/tests/units/test_safe_build.py index 0eade9975..eb3649c28 100644 --- a/tests/units/test_safe_build.py +++ b/tests/units/test_safe_build.py @@ -84,7 +84,7 @@ def chunk(): with self.assertLogs(self.logger, logging.WARN) as cm: # assertLogs fails if no warning is raised - self.logger.warn("Dummy warning") + self.logger.warning("Dummy warning") self.awsd.check_manifest_file_list(product_path) self.assertEqual(len(cm.output), 1) @@ -128,7 +128,7 @@ def chunk(): with self.assertLogs(self.logger, logging.WARN) as cm: # assertLogs fails if no warning is raised - self.logger.warn("Dummy warning") + self.logger.warning("Dummy warning") self.awsd.check_manifest_file_list(product_path) self.assertEqual(len(cm.output), 1) @@ -172,7 +172,7 @@ def chunk(): with self.assertLogs(self.logger, logging.WARN) as cm: # assertLogs fails if no warning is raised - self.logger.warn("Dummy warning") + self.logger.warning("Dummy warning") self.awsd.check_manifest_file_list(product_path) self.assertEqual(len(cm.output), 2)