From 85b8c963b5ff1c18cd9980d8877871ee416710cb Mon Sep 17 00:00:00 2001 From: vyom-aggarwal Date: Sat, 22 Aug 2026 00:19:52 -0700 Subject: [PATCH] skip solved2dof benchmarks when pyOptSparse is unavailable Both tests in test_bench_solved2dof.py drive the problem with IPOPT, which requires pyOptSparse, but the file never imported or applied @require_pyoptsparse. Without pyOptSparse installed they raise "ImportError: pyOptSparseDriver is not available" and fail, rather than skipping the way every other pyOptSparse-dependent benchmark does. This is the only benchmark file that uses a pyOptSparse optimizer without the decorator; the 20 others already guard their IPOPT/SNOPT tests this way. --- .../validation_cases/benchmark_tests/test_bench_solved2dof.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aviary/validation_cases/benchmark_tests/test_bench_solved2dof.py b/aviary/validation_cases/benchmark_tests/test_bench_solved2dof.py index 1152bc4773..ffb22aefb1 100644 --- a/aviary/validation_cases/benchmark_tests/test_bench_solved2dof.py +++ b/aviary/validation_cases/benchmark_tests/test_bench_solved2dof.py @@ -4,13 +4,14 @@ from aviary.models.missions.solved2dof_default import phase_info from aviary.models.missions.solved2dof_landing_default import phase_info as phase_info_landing from openmdao.utils.assert_utils import assert_near_equal -from openmdao.utils.testing_utils import use_tempdirs +from openmdao.utils.testing_utils import require_pyoptsparse, use_tempdirs @use_tempdirs class TestBenchSolved2DOF(unittest.TestCase): """Run the model in serial that is setup in ProblemPhaseTestCase class.""" + @require_pyoptsparse(optimizer='IPOPT') def test_bench_Solved2DOF(self): subsystem_options = { 'aerodynamics': { @@ -106,6 +107,7 @@ def test_bench_Solved2DOF(self): assert_near_equal(prob.get_val(av.Mission.FINAL_TIME, units='s'), 108.84030411, tol) assert_near_equal(prob.get_val(av.Mission.FUEL_MASS, units='lbm'), 459.3830223, tol) + @require_pyoptsparse(optimizer='IPOPT') def test_bench_Solved2DOF_landing(self): # This problem solves better with a reduced ref for objective time, therefore need to call add_objectve() subsystem_options = {