Skip to content

Commit

Permalink
Add delay after test avoiding API limit, if any
Browse files Browse the repository at this point in the history
  • Loading branch information
mgcth committed May 5, 2024
1 parent faae852 commit ad2e1da
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/integration/test_integration_mesan.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Mesan integration tests."""

import time

import arrow
import pytest
from smhi.constants import MESAN_PARAMETER_DESCRIPTIONS
Expand Down Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -50,13 +56,17 @@ 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()
geo_polygon = client.geo_polygon
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."""
Expand All @@ -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."""
Expand All @@ -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",
[
Expand All @@ -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)
6 changes: 6 additions & 0 deletions tests/integration/test_integration_strang.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Strang integration tests."""

import time

import pandas as pd
import pytest
from smhi.strang import Strang
Expand Down Expand Up @@ -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.
Expand All @@ -113,3 +117,5 @@ def test_integration_strang_multipoint(self, get_multipoint):
get_multipoint,
multipoint_model.df.iloc[:10, :],
)

time.sleep(1)

0 comments on commit ad2e1da

Please sign in to comment.