skip solved2dof benchmarks when pyOptSparse is unavailable - #1278
Open
vyom-aggarwal wants to merge 1 commit into
Open
skip solved2dof benchmarks when pyOptSparse is unavailable#1278vyom-aggarwal wants to merge 1 commit into
vyom-aggarwal wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Summary
aviary/validation_cases/benchmark_tests/test_bench_solved2dof.py runs both of its benchmarks with the IPOPT optimizer (optimizer='IPOPT' in test_bench_Solved2DOF, add_driver('IPOPT', ...) in test_bench_Solved2DOF_landing), which requires pyOptSparse. The file never imported or applied @require_pyoptsparse, so in an environment without pyOptSparse both tests fail:
ImportError: pyOptSparseDriver is not available, pyOptsparse is not installed.
This is the only benchmark file that uses a pyOptSparse optimizer without the decorator. The other 20 benchmark files already guard their IPOPT/SNOPT tests this way, and test_subsystems_within_a_mission.py correctly needs no guard because it uses SLSQP. This was not a regression: IPOPT has been used here since the file was added in 529de2f, and the decorator was never present.
This PR adds @require_pyoptsparse(optimizer='IPOPT') to both tests so they skip cleanly, matching the existing convention in test_bench_GwGm.py.
Effect on a full testflo . run without pyOptSparse: 2 failed / 46 skipped becomes 0 failed / 48 skipped. On a machine that does have pyOptSparse with IPOPT, behavior is unchanged: require_pyoptsparse returns the test object untouched when the import and OPT(optimizer) both succeed, so these benchmarks still run and still assert as before.
Related Issues
Resolves #
Backwards incompatibilities
None. No source behavior changes; this only affects test collection when an optional dependency is missing.
AI Usage
This change was assisted with Claude (Opus 5) via Claude Code. The AI model didn't code anything, but instead helped me get an idea of what I need to do.