From ad2e1da2cc0d4b9e0632b14f9778e5b608093be6 Mon Sep 17 00:00:00 2001 From: Mladen Gibanica <11275336+mgcth@users.noreply.github.com> Date: Sun, 5 May 2024 08:19:25 +0200 Subject: [PATCH] Add delay after test avoiding API limit, if any --- tests/integration/test_integration_mesan.py | 16 ++++++++++++++++ tests/integration/test_integration_strang.py | 6 ++++++ 2 files changed, 22 insertions(+) diff --git a/tests/integration/test_integration_mesan.py b/tests/integration/test_integration_mesan.py index ebc4e5d3..6bdd3b24 100644 --- a/tests/integration/test_integration_mesan.py +++ b/tests/integration/test_integration_mesan.py @@ -1,5 +1,7 @@ """Mesan integration tests.""" +import time + import arrow import pytest from smhi.constants import MESAN_PARAMETER_DESCRIPTIONS @@ -32,6 +34,8 @@ def test_integration_mesan_approved_time(self): approved_time = client.approved_time.approved_time assert datetime_between_day(approved_time) + time.sleep(1) + def test_integration_mesan_parameters(self): """Integration test for parameters property.""" client = Mesan() @@ -41,6 +45,8 @@ def test_integration_mesan_parameters(self): ) assert len(parameters.parameter) > NUM_PARAMETERS + time.sleep(1) + def test_integration_mesan_valid_time(self): """Integration test for approved time property.""" client = Mesan() @@ -50,6 +56,8 @@ def test_integration_mesan_valid_time(self): assert len(valid_time) == NUM_VALID_TIME + time.sleep(1) + def test_integration_mesan_geo_polygon(self): """Integration test for geo_polygon property.""" client = Mesan() @@ -57,6 +65,8 @@ def test_integration_mesan_geo_polygon(self): assert geo_polygon.type_ == GEO_POLYGON_TYPE assert len(geo_polygon.coordinates[0]) > NUM_GEO_COORDINATES + time.sleep(1) + @pytest.mark.parametrize("downsample", [(1)]) def test_integration_mesan_get_geo_multipoint(self, downsample): """Integration test for get_geo_multipoint method.""" @@ -65,6 +75,8 @@ def test_integration_mesan_get_geo_multipoint(self, downsample): assert geo_multipoint.type_ == GEO_MULTIPOINT_TYPE assert len(geo_multipoint.coordinates) > NUM_GEO_COORDINATES + time.sleep(1) + @pytest.mark.parametrize("lat, lon", [(58, 16)]) def test_integration_mesan_get_point(self, lat, lon): """Integration test for get_point method.""" @@ -75,6 +87,8 @@ def test_integration_mesan_get_point(self, lat, lon): assert not point.df.empty assert point.df["t"].iloc[0] > MIN_TEMPERATURE + time.sleep(1) + @pytest.mark.parametrize( "validtime, parameter, level_type, level, geo, downsample", [ @@ -99,3 +113,5 @@ def test_integration_mesan_get_multipoint( assert not multipoint.df.empty assert multipoint.df["value"].iloc[0] > MIN_TEMPERATURE + + time.sleep(1) diff --git a/tests/integration/test_integration_strang.py b/tests/integration/test_integration_strang.py index 2ec17995..e37662d8 100644 --- a/tests/integration/test_integration_strang.py +++ b/tests/integration/test_integration_strang.py @@ -1,5 +1,7 @@ """Strang integration tests.""" +import time + import pandas as pd import pytest from smhi.strang import Strang @@ -90,6 +92,8 @@ def test_integration_strang_point( else: assert expected_result == point_model.df.index.name + time.sleep(1) + def test_integration_strang_multipoint(self, get_multipoint): """Strang MultiPoint integration tests. @@ -113,3 +117,5 @@ def test_integration_strang_multipoint(self, get_multipoint): get_multipoint, multipoint_model.df.iloc[:10, :], ) + + time.sleep(1)