Skip to content

Commit

Permalink
Make tests more robust by updating now constantly. The issue rises wi…
Browse files Browse the repository at this point in the history
…th using Lappeenranta Airport as measurement point, as it updates once per minute.
  • Loading branch information
kipe committed Dec 21, 2020
1 parent ba37080 commit c54f8e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions tests/test_forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@

class TestForecast(unittest.TestCase):
def test_lappeenranta(self):
now = datetime.now(tz=tzutc())

f = FMI(place='Lappeenranta')
for point in f.forecast():
assert point.time > now
assert point.time > datetime.now(tz=tzutc())
assert isinstance(point.temperature, float)

f = FMI(coordinates='%.03f,%.03f' % (61.058876, 28.186262))
for point in f.forecast():
assert point.time > now
assert point.time > datetime.now(tz=tzutc())
assert isinstance(point.temperature, float)
6 changes: 2 additions & 4 deletions tests/test_observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@

class TestObservations(unittest.TestCase):
def test_lappeenranta(self):
now = datetime.now(tz=tzutc())

f = FMI(place='Lappeenranta')
for point in f.observations():
assert point.time < now
assert point.time < datetime.now(tz=tzutc())
assert isinstance(point.temperature, float)

for point in f.observations(fmisid=101237):
assert point.time < now
assert point.time < datetime.now(tz=tzutc())
assert isinstance(point.temperature, float)

0 comments on commit c54f8e9

Please sign in to comment.