diff --git a/tests/fixtures/environment/environment_fixtures.py b/tests/fixtures/environment/environment_fixtures.py index 97bf07381..2b787a1f3 100644 --- a/tests/fixtures/environment/environment_fixtures.py +++ b/tests/fixtures/environment/environment_fixtures.py @@ -1,12 +1,11 @@ -import datetime - import pytest - +import os +from datetime import datetime, timedelta from rocketpy import Environment, EnvironmentAnalysis @pytest.fixture -def example_env(): +def example_plain_env(): """Simple object of the Environment class to be used in the tests. Returns @@ -24,43 +23,35 @@ def example_date_naive(): ------- datetime.datetime """ - return datetime.datetime.now() + return datetime.now() + timedelta(days=1) @pytest.fixture -def example_env_robust(): - """Create an object of the Environment class to be used in the tests. This - allows to avoid repeating the same code in all tests. The environment set - here is a bit more complex than the one in the example_env fixture. This - time the latitude, longitude and elevation are set, as well as the datum and - the date. The location refers to the Spaceport America Cup launch site, - while the date is set to tomorrow at noon. +def example_spaceport_env(example_date_naive): + """Environment class with location set to Spaceport America Cup launch site Returns ------- rocketpy.Environment - An object of the Environment class """ - env = Environment( + spaceport_env = Environment( latitude=32.990254, longitude=-106.974998, elevation=1400, datum="WGS84", ) - tomorrow = datetime.date.today() + datetime.timedelta(days=1) - env.set_date((tomorrow.year, tomorrow.month, tomorrow.day, 12)) - return env + spaceport_env.set_date(example_date_naive) + yield spaceport_env + os.remove("environment.json") @pytest.fixture def env_analysis(): - """Create a simple object of the Environment Analysis class to be used in - the tests. This allows to avoid repeating the same code in all tests. + """Environment Analysis class with hardcoded parameters Returns ------- EnvironmentAnalysis - A simple object of the Environment Analysis class """ env_analysis = EnvironmentAnalysis( start_date=datetime.datetime(2019, 10, 23),