Skip to content

Remove get_option_defaults #1251

Description

@jkirk5

Desired capability or behavior.

The utility get_option_defaults() (in aviary.variable_info.options.py) which sets up an AviaryValues object with every variable set to their default units. This is often used to set up tests. This util makes the tests extremely annoying to debug because it makes it very opaque which inputs are being set that the component actually uses, and what value they are set to. The defaults are mostly zero anyway, and also add an unnecessary dependency for tests on default values in metadata. If a default is change, it shouldn't break every single test using that variable.

TLDR: get_option_defaults() is a shortcut that obscures 1. what variables are actually necessary for a test, 2. their values, and 3. creates fragile dependencies for the tests on the current metadata defaults

Suggested implementation.

Update tests to not use get_option_defaults() and instead directly set input values for the OM problem. If there are no special cases where get_option_defaults() is absolutely essential, it should be completely removed. I can't think of any good reasons why this should exist, as it is a dangerous tool that looks like a handy shortcut but can be a little bit of a trap for the aforementioned reasons.

Metadata

Metadata

Labels

good first issueGood for newcomersrequestSuggestion for new feature or changevalidationTesting and verification/validation of components and models

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions