Skip to content

Commit

Permalink
TST: Fix tests with Environment class after exponential_backoff decor…
Browse files Browse the repository at this point in the history
…ator was used
  • Loading branch information
Gui-FernandesBR committed Apr 19, 2024
1 parent d0fbcd7 commit a8a185e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
5 changes: 3 additions & 2 deletions tests/fixtures/environment/environment_fixtures.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from datetime import datetime, timedelta

import pytest

from rocketpy import Environment, EnvironmentAnalysis


Expand Down Expand Up @@ -54,8 +55,8 @@ def env_analysis():
EnvironmentAnalysis
"""
env_analysis = EnvironmentAnalysis(
start_date=datetime.datetime(2019, 10, 23),
end_date=datetime.datetime(2021, 10, 23),
start_date=datetime(2019, 10, 23),
end_date=datetime(2021, 10, 23),
latitude=39.3897,
longitude=-8.28896388889,
start_hour=6,
Expand Down
10 changes: 2 additions & 8 deletions tests/test_environment.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import datetime
import time
from unittest.mock import patch

import pytest
Expand Down Expand Up @@ -64,13 +63,8 @@ def test_wyoming_sounding_atmosphere(mock_show, example_plain_env):
# "file" option, instead of receiving the URL as a string.
URL = "http://weather.uwyo.edu/cgi-bin/sounding?region=samer&TYPE=TEXT%3ALIST&YEAR=2019&MONTH=02&FROM=0500&TO=0512&STNM=83779"
# give it at least 5 times to try to download the file
for i in range(5):
try:
example_plain_env.set_atmospheric_model(type="wyoming_sounding", file=URL)
break
except:
time.sleep(1) # wait 1 second before trying again
pass
example_plain_env.set_atmospheric_model(type="wyoming_sounding", file=URL)

assert example_plain_env.all_info() == None
assert abs(example_plain_env.pressure(0) - 93600.0) < 1e-8
assert (
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_environment.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import json
import os

import numpy as np
import numpy.ma as ma
import pytest
import pytz
import json

from rocketpy import Environment

Expand Down

0 comments on commit a8a185e

Please sign in to comment.