diff --git a/CHANGELOG.md b/CHANGELOG.md index bfd5501ae..9e49d8abf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ Attention: The newest changes should be on top --> ### Added +- ENH: Allow for Alternative and Custom ODE Solvers. [#748](https://github.com/RocketPy-Team/RocketPy/pull/748) ### Changed diff --git a/tests/integration/test_flight.py b/tests/integration/test_flight.py index fc1dd1956..5fdeb9c3d 100644 --- a/tests/integration/test_flight.py +++ b/tests/integration/test_flight.py @@ -11,7 +11,8 @@ @patch("matplotlib.pyplot.show") -def test_all_info(mock_show, flight_calisto_robust): # pylint: disable=unused-argument +# pylint: disable=unused-argument +def test_all_info(mock_show, flight_calisto_robust): """Test that the flight class is working as intended. This basically calls the all_info() method and checks if it returns None. It is not testing if the values are correct, but whether the method is working without errors. @@ -27,6 +28,42 @@ def test_all_info(mock_show, flight_calisto_robust): # pylint: disable=unused-a assert flight_calisto_robust.all_info() is None +@pytest.mark.slow +@patch("matplotlib.pyplot.show") +@pytest.mark.parametrize("solver_method", ["RK45", "DOP853", "Radau", "BDF"]) +# RK23 is unstable and requires a very low tolerance to work +# pylint: disable=unused-argument +def test_all_info_different_solvers( + mock_show, calisto_robust, example_spaceport_env, solver_method +): + """Test that the flight class is working as intended with different solver + methods. This basically calls the all_info() method and checks if it returns + None. It is not testing if the values are correct, but whether the method is + working without errors. + + Parameters + ---------- + mock_show : unittest.mock.MagicMock + Mock object to replace matplotlib.pyplot.show + calisto_robust : rocketpy.Rocket + Rocket to be simulated. See the conftest.py file for more info. + example_spaceport_env : rocketpy.Environment + Environment to be simulated. See the conftest.py file for more info. + solver_method : str + The solver method to be used in the simulation. + """ + test_flight = Flight( + environment=example_spaceport_env, + rocket=calisto_robust, + rail_length=5.2, + inclination=85, + heading=0, + terminate_on_apogee=False, + ode_solver=solver_method, + ) + assert test_flight.all_info() is None + + class TestExportData: """Tests the export_data method of the Flight class."""